Skip to content

Commit

Permalink
chore: add pre-release-branch-update GitHub action. Fix prev commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Zorkaltsev authored and Alexey Zorkaltsev committed Sep 13, 2023
1 parent 1c0f9e8 commit 9c66dd7
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 17 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/build-typescript.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/pre-release-branch-update.yml
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
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"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions PRE-RELEASE.md
Original file line number Diff line number Diff line change
@@ -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*.

0 comments on commit 9c66dd7

Please sign in to comment.