Skip to content

chore(deps): update dependency concurrently to v8 - autoclosed #64

chore(deps): update dependency concurrently to v8 - autoclosed

chore(deps): update dependency concurrently to v8 - autoclosed #64

name: Release stage 2 - auto publish
on:
pull_request: # types AND paths
types: [closed]
paths: ['package.json']
# NOTE: While this is too generic, we use the `if` condition of the job to narrow it down
# NOTE: Don't use `branches` as we might create release on any branch
env:
# Best not to include the GH token here, only do it for the steps that need it
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
CHANGELOG_FILE: CHANGES.md
jobs:
publish:
if: >- # NOTE: Can't use top-level env here unfortunately
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'release')
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
ref: ${{ env.MERGE_SHA }}
- name: Install
run: yarn install
- name: Build
run: yarn build --optimize
- name: Get the version number
run: |
VERSION=$(node -p -e "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create ZIP archive
working-directory: dist
run: |
filename="cylc-ui-${VERSION}-dist.zip"
zip -r "../$filename" *
echo "ZIP_ARCHIVE=$filename" >> $GITHUB_ENV
- name: sha256sum
run: |
SHA256SUM=$(sha256sum ${{ env.ZIP_ARCHIVE }})
echo "SHA256SUM=$SHA256SUM" >> $GITHUB_ENV
- name: Publish GitHub release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitish: ${{ env.MERGE_SHA }}
tag_name: ${{ env.VERSION }}
release_name: cylc-ui ${{ env.VERSION }}
# TODO: `npm version` doesn't indicate whether it's a prerelease or not
# prerelease: ${{ env.PRERELEASE }}
draft: false
body: |
See [${{ env.CHANGELOG_FILE }}](https://github.com/${{ github.repository }}/blob/master/${{ env.CHANGELOG_FILE }}) for detail.
sha256sum: ${{ env.SHA256SUM }}
# TODO: Get topmost changelog section somehow and use that as the body?
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ env.ZIP_ARCHIVE }}
asset_name: ${{ env.ZIP_ARCHIVE }}
asset_content_type: application/zip
- name: Comment on the release PR with the results & next steps
if: always()
uses: cylc/release-actions/stage-2/comment-on-pr@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release-url: ${{ steps.create-release.outputs.html_url }}