Skip to content

v0.1.22-prerelease

v0.1.22-prerelease #34

Workflow file for this run

name: Publish new release
on:
release:
types:
- published
jobs:
check:
name: Pre-release checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get and validate version number
id: get-version
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
./tasks/validate-version.sh "$VERSION"
outputs:
version: ${{ steps.get-version.outputs.VERSION }}
lint:
runs-on: ubuntu-latest
needs:
- check
steps:
- uses: actions/checkout@v3
- name: Lint
uses: ./.github/actions/lint
tests:
runs-on: ubuntu-latest
needs:
- check
steps:
- uses: actions/checkout@v3
- name: Tests
uses: ./.github/actions/tests
test-build:
runs-on: ubuntu-latest
needs:
- check
steps:
- uses: actions/checkout@v3
- name: Test build Storybook
uses: ./.github/actions/test-build
test-build-package:
runs-on: ubuntu-latest
needs:
- check
steps:
- uses: actions/checkout@v3
- name: Test build package
uses: ./.github/actions/test-build-package
prototype-kit:
runs-on: ubuntu-latest
needs:
- test-build-package
steps:
- uses: actions/checkout@v3
- name: GOV.UK prototype kit test
uses: ./.github/actions/prototype-kit-test
publish-npm:
name: Build package and publish to npm
runs-on: ubuntu-latest
needs:
- check
- lint
- tests
- test-build
- prototype-kit
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org/
scope: '@nationalarchives'
- name: Install dependencies
run: npm ci
- name: Build package
run: ./tasks/build-package.sh
- name: Check npm credentials
run: npm whoami
- name: Publish to npm
run: cd package && npm publish
- name: Rename package directory
run: mv package "nationalarhives-frontend-${{ needs.check.outputs.version }}"
- name: Upload the package to the GitHub release
run: gh release upload "v${{ needs.check.outputs.version }}" "nationalarhives-frontend-${{ needs.check.outputs.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
notify-slack:
runs-on: ubuntu-latest
needs:
- check
- publish-npm
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON: "https://raw.githubusercontent.com/nationalarchives/tna-frontend/main/src/nationalarchives/assets/images/apple-touch-icon.png"
SLACK_TITLE: "v${{ needs.check.outputs.version }} of `tna-frontend` has just been published"