-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(js): setup release flow #608
Open
osipov-mit
wants to merge
3
commits into
master
Choose a base branch
from
do-setup-js-release
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
*.ts text | ||
*.json text | ||
yarn.lock merge=union | ||
*.wasm binary merge=binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- package.json | ||
|
||
name: JS release | ||
|
||
jobs: | ||
release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: 'Setup NodeJS 20.x' | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: 'Get version from package.json' | ||
run: | | ||
VERSION=$(jq -r '.version' package.json) | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "TAG_NAME=js/$VERSION" >> $GITHUB_ENV | ||
|
||
- name: 'Get previous version from npm registry' | ||
run: | | ||
PREVIOUS_VERSION=$(npm show @js/package version) | ||
echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_ENV | ||
|
||
- name: 'Compare versions' | ||
run: | | ||
if [ ${{ env.VERSION }} == ${{ env.PREVIOUS_VERSION }} ]; then | ||
echo "No new version to release" | ||
echo "skip=true" >> $GITHUB_ENV | ||
else | ||
echo "New version to release" | ||
echo "skip=false" >> $GITHUB_ENV | ||
fi | ||
|
||
- name: 'Get release notes' | ||
if: env.skip != 'true' | ||
run: | | ||
awk '/## ${{ env.VERSION }}/{flag=1;next}/---/{flag=0} flag' ./js/CHANGELOG.md >> release_notes.txt | ||
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | ||
cat release_notes.txt >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
rm release_notes.txt | ||
|
||
- name: 'Create new tag' | ||
if: env.skip != 'true' | ||
run: | | ||
git tag ${{ env.TAG_NAME }} | ||
git push origin ${{ env.TAG_NAME }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't you want to do at the very last point? Does the next action require the tag to exist? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's actually used in the very next step. |
||
|
||
- name: 'Create Release' | ||
if: env.skip != 'true' | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
body: ${{ env.RELEASE_NOTES }} | ||
tag_name: ${{ env.TAG_NAME }} | ||
|
||
- name: 'Prepare: install dependencies and build pkgs' | ||
if: env.skip != 'true' | ||
run: | | ||
yarn install | ||
yarn build | ||
|
||
- name: Publish | ||
if: env.skip != 'true' | ||
run: | | ||
export token=$(printenv npm_token) | ||
echo "//registry.npmjs.org/:_authToken=$token" > .npmrc | ||
npx lerna publish from-package --yes --no-private | ||
env: | ||
npm_token: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# CHANGELOG | ||
|
||
## 0.3.1 (draft) | ||
|
||
### Changes | ||
- Setup releases (https://github.com/gear-tech/sails/pull/608) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
echo "[*] Building parser wasm" | ||
cargo build -p sails-idl-parser --target=wasm32-unknown-unknown --release | ||
echo "[*] Optimizing parser wasm" | ||
wasm-opt -O4 -o ./js/parser/parser.wasm ./target/wasm32-unknown-unknown/release/sails_idl_parser.wasm | ||
ls -l ./js/parser/parser.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version=$1 | ||
|
||
echo "Bumping versions to $version" | ||
|
||
pkgs=("package.json" "./js/package.json" "./js/cli/package.json" "./js/parser/package.json" "./js/types/package.json" "./js/util/package.json") | ||
|
||
for pkg in ${pkgs[@]}; do | ||
jq ".version = \"$version\"" $pkg > tmp.$$.json && mv tmp.$$.json $pkg | ||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you wanted to support the
release
trigger. Do you want to release on every merge into master regardless of changes?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. The release will only be triggered on commits affecting root
package.json
and there is a step that checks if the version has been changed