-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from paulRbr/automated-release
core: add release step in CI to push packed tarballs to GH release
- Loading branch information
Showing
2 changed files
with
63 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Release | ||
on: | ||
workflow_run: | ||
workflows: [ "Developer checks" ] | ||
types: [ completed ] | ||
jobs: | ||
# This 'check_tag' job is a hack because Github doesn't provide the full ref from the | ||
# original triggered workflow. Hopefully in the future we will only have to change | ||
# the condition of the `release` job to: | ||
# | ||
# ${{ github.event.workflow_run.conclusion == 'success' && | ||
# startsWith(github.event.workflow_run, 'refs/tag/v') }} | ||
check_tag: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
run_release: ${{ steps.check-tag.outputs.run_jobs }} | ||
tag: ${{ steps.check-tag.outputs.ref }} | ||
steps: | ||
- name: check reference of dependent workflow ${{ github.event.workflow_run.head_branch }} | ||
id: check-tag | ||
run: | | ||
if [[ ${{ github.event.workflow_run.head_branch }} =~ v[0-9]+\.[0-9]+\.[0-9]+.* ]]; then | ||
echo "::set-output name=run_jobs::true" | ||
echo "::set-output name=ref::${{ github.event.workflow_run.head_branch }}" | ||
else | ||
echo "::set-output name=run_jobs::false" | ||
fi | ||
release: | ||
needs: [check_tag] | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && needs.check_tag.outputs.run_release == 'true' }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node_version: [ '15' ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ needs.check_tag.outputs.tag }} | ||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: node-${{ matrix.node_version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
node-${{ matrix.node_version }}-build-${{ env.cache-name }}- | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
- run: npm ci | ||
- run: npm run pack | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: dist/**/* | ||
draft: true | ||
tag_name: ${{ needs.check_tag.outputs.tag }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_REPOSITORY: bump-sh/cli |
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