Skip to content

chore(deps): update tests packages #639

chore(deps): update tests packages

chore(deps): update tests packages #639

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@v4
with:
ref: ${{ env.MERGE_SHA }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install
run: yarn install
- name: Build
run: yarn build
- 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: cylc/release-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 details.
sha256sum:
```
${{ env.SHA256SUM }}
```
# TODO: Get topmost changelog section somehow and use that as the body?
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "$VERSION" "$ZIP_ARCHIVE"
- 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 }}