Skip to content

Commit

Permalink
check release (#873)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickycodes authored Jul 11, 2022
1 parent b7db452 commit 7de1070
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
contents: write
# release merge commits come from GitHub user
if: github.event.head_commit.committer.name == 'GitHub'
outputs:
IS_RELEASE: ${{ steps.check-release.outputs.IS_RELEASE }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -18,20 +20,29 @@ jobs:
# we need this commit + the last so we can compare below
fetch-depth: 2
# exit early if the version has not changed
- run: ./scripts/check-version.sh ${{ github.event.before }}
- name: Check Release
id: check-release
run: ./scripts/check-release.sh ${{ github.event.before }}
- name: Get Node.js version
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
id: nvm
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- uses: actions/setup-node@v2
- name: Setup Node
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-node@v2
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- uses: MetaMask/[email protected]
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- name: Install
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: |
yarn install
yarn build
- uses: actions/cache@v3
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
id: restore-build
with:
path: ./dist
Expand All @@ -40,6 +51,7 @@ jobs:
publish-npm-dry-run:
runs-on: ubuntu-latest
needs: publish-release
if: ${{ needs.publish-release.outputs.IS_RELEASE == 'true' }}
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -61,6 +73,7 @@ jobs:
environment: npm-publish
runs-on: ubuntu-latest
needs: publish-npm-dry-run
if: ${{ needs.publish-release.outputs.IS_RELEASE == 'true' }}
steps:
- uses: actions/checkout@v2
with:
Expand Down
5 changes: 4 additions & 1 deletion scripts/check-version.sh → scripts/check-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ VERSION_BEFORE="$(git show "$BEFORE":package.json | jq --raw-output .version)"
VERSION_AFTER="$(jq --raw-output .version package.json)"
if [[ "$VERSION_BEFORE" == "$VERSION_AFTER" ]]; then
echo "Notice: version unchanged. Skipping release."
exit 1
echo "::set-output name=IS_RELEASE::false"
exit 0
fi

echo "::set-output name=IS_RELEASE::true"

0 comments on commit 7de1070

Please sign in to comment.