-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(js): setup release flow (#608)
- Loading branch information
1 parent
9259280
commit 2ef5701
Showing
13 changed files
with
213 additions
and
151 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,49 @@ | ||
name: '[js] CI' | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, labeled] | ||
branches: [master] | ||
paths: | ||
- 'js/**' | ||
- 'package.json' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Cancel previous workflow runs | ||
uses: styfle/cancel-workflow-action@0.12.1 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: 'Install: NodeJS 20.x' | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: 'Install: dependencies' | ||
run: yarn install | ||
|
||
- name: 'Prepare: build all' | ||
run: yarn build | ||
|
||
- name: 'Prepare: fmt' | ||
run: yarn lint | ||
|
||
- name: 'Prepare: download Gear node' | ||
run: | | ||
wget -O ./gear https://github.com/gear-tech/gear/releases/download/build/gear | ||
chmod +x gear | ||
- name: 'Prepare: run Gear node' | ||
run: nohup ./gear --dev --execution=wasm --tmp --unsafe-rpc-external --rpc-methods Unsafe --rpc-cors all & | ||
|
||
- name: 'Prepare: sleep 3 min' | ||
run: sleep 180 | ||
|
||
- name: 'Test: run' | ||
run: yarn test |
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,80 @@ | ||
name: '[js] Release' | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- package.json | ||
|
||
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 info' | ||
id: info | ||
run: | | ||
VERSION=$(jq -r '.version' package.json) | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
echo "tag_name=js/v$VERSION" >> $GITHUB_OUTPUT | ||
PREVIOUS_VERSION=$(npm show @js/package version) | ||
echo "prev_version=$PREVIOUS_VERSION" >> $GITHUB_OUTPUT | ||
- name: 'Compare versions' | ||
id: release | ||
run: | | ||
if [ ${{ steps.info.outputs.version }} == ${{ steps.info.outputs.prev_version }} ]; then | ||
echo "No new version to release" | ||
echo "skip=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "New version to release" | ||
echo "skip=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: 'Get release notes' | ||
id: release_notes | ||
if: steps.release.outputs.skip != 'true' | ||
run: | | ||
awk '/## ${{ steps.info.outputs.version }}/{flag=1;next}/---/{flag=0} flag' ./js/CHANGELOG.md >> release_notes.txt | ||
echo "release_notes<<EOF" >> $GITHUB_OUTPUT | ||
cat release_notes.txt >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
rm release_notes.txt | ||
- name: 'Prepare: install dependencies and build pkgs' | ||
if: steps.release.outputs.skip != 'true' | ||
run: | | ||
yarn install | ||
yarn build | ||
- name: 'Create new tag' | ||
if: steps.release.outputs.skip != 'true' | ||
run: | | ||
git tag ${{ steps.info.outputs.tag_name }} | ||
git push origin ${{ steps.info.outputs.tag_name }} | ||
- name: 'Create Release' | ||
if: steps.release.outputs.skip != 'true' | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
body: ${{ steps.release_notes.outputs.release_notes }} | ||
tag_name: ${{ steps.info.outputs.tag_name }} | ||
name: 'Sails-JS v${{ steps.info.outputs.version }}' | ||
|
||
- name: 'Publish to npm registry' | ||
if: steps.release.outputs.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,9 @@ | ||
# CHANGELOG | ||
|
||
## 0.3.1 (draft) | ||
|
||
### Compatibility | ||
- Sails-RS v0.6.3 | ||
|
||
### Changes | ||
- Setup automated releases in https://github.com/gear-tech/sails/pull/608 |
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,3 @@ | ||
{ | ||
"sails-rs": "0.6.3" | ||
} |
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 |
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
Oops, something went wrong.