diff --git a/.github/workflows/build-typescript.yml b/.github/workflows/build-typescript.yml deleted file mode 100644 index f86b2bb6..00000000 --- a/.github/workflows/build-typescript.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Build typescrit -on: - push: - branches: - - master -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout project - uses: actions/checkout@v3 - - name: Build and push - uses: alexthemaster/action-build-typescript@v1.3.1 - with: - pushToBranch: true # optional; can either be true or false | defaults to false - branch: 'dist' # optional; the name of the branch the action should push the compiled code to | defaults to dist - githubToken: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }} # required if you use the pushToBranch option diff --git a/.github/workflows/pre-release-branch-update.yml b/.github/workflows/pre-release-branch-update.yml new file mode 100644 index 00000000..55e37d81 --- /dev/null +++ b/.github/workflows/pre-release-branch-update.yml @@ -0,0 +1,55 @@ +# Action setup: +# +# Copy this action to .github/workflows +# +# Add YDB_PLATFORM_BOT_TOKEN_REPO, which is Personal Access Token (PAT), to secrets or rename YDB_PLATFORM_BOT_TOKEN_REPO in this code to an already existing token +# +# Add to .gitignore a comment before line that ignores result of the build with the following postfix: +# (next line will be removed by pre-release-branch-update GitHub action to be included in dist branch) +# +# Copy PRE-RELEASE.md rom this project + +name: Pre-Release branch update +on: + push: + branches: + - main + - master +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@v3 + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + - name: Install dependencies + run: npm ci + shell: bash + - name: Remove build result from .gitignore + uses: jacobtomlinson/gha-find-replace@v3 + with: + include: ".gitignore" + find: "#.*\\(next line will be removed by pre-release-branch-update GitHub action to be included in dist branch\\)\\n.*\\n" + replace: "###\n" + - name: .gitignore + run: cat .gitignore + shell: bash + - name: Build typescript project + run: npm run build + shell: bash + - name: ls + run: ls + shell: bash + - name: Commit files to pre-release branch + run: | + git config --local user.email "azorkaltsev@yandex-team.ru" + git config --local user.name "pre-release-to-branch[action]" + git add . + git commit -a -m "Typescript build" + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }} + branch: "pre-release" diff --git a/.gitignore b/.gitignore index 4bc68064..071d86cf 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ node_modules #temporary tmp/ temp/ + +# typescript build (next line will be removed by pre-release-branch-update GitHub action to be included in dist branch) build/ #personal diff --git a/PRE-RELEASE.md b/PRE-RELEASE.md new file mode 100644 index 00000000..0281edaf --- /dev/null +++ b/PRE-RELEASE.md @@ -0,0 +1,14 @@ +# PRE-RELEASE project preview + +The idea of Pre-release is to let the project can be tried out before the official release when the project code is +committed to npm with a new version assignment. + +GitHub action pre-release-branch-update takes action when an code update was pushed to the main (master) +branch. The action performs the project build, enabling save the result in git, and saves the result to +the pre-release branch. + +Later, this code can be tested by adding to a test project using command +*npm install https://github.com/ydb-platform/ydb-nodejs-sdk.git#pre-release*. + +When making changes to a project and building a new pre-release version by git push. It is **necessary** +to update the code of the component in test projects via *npm update*.