Skip to content

v0.2.15

v0.2.15 #96

Workflow file for this run

name: Publish release
on:
release:
types:
- published
jobs:
version-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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:
- version-check
steps:
- uses: actions/checkout@v4
- name: Lint
uses: ./.github/actions/lint
tests:
runs-on: ubuntu-latest
needs:
- version-check
steps:
- uses: actions/checkout@v4
- name: Tests
uses: ./.github/actions/tests
storybook-tests:
runs-on: ubuntu-latest
needs:
- version-check
steps:
- uses: actions/checkout@v4
- name: Tests
uses: ./.github/actions/storybook-tests
test-package:
runs-on: ubuntu-latest
needs:
- version-check
steps:
- uses: actions/checkout@v4
- name: Test build package
uses: ./.github/actions/test-package
prototype-kit:
runs-on: ubuntu-latest
needs:
- test-package
steps:
- uses: actions/checkout@v4
- name: GOV.UK prototype kit test
uses: ./.github/actions/prototype-kit-test
publish-npm:
runs-on: ubuntu-latest
needs:
- version-check
- lint
- tests
- storybook-tests
- prototype-kit
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org/
scope: '@nationalarchives'
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build:package
- name: Check npm credentials
run: npm whoami
- name: Publish to npm
run: cd package && npm publish
- name: Rename package directory
run: mv package "tna-frontend-${{ needs.version-check.outputs.version }}"
- name: Compress package
run: zip -r "tna-frontend-${{ needs.version-check.outputs.version }}.zip" "tna-frontend-${{ needs.version-check.outputs.version }}"
- name: Upload the package to the GitHub release
run: gh release upload "v${{ needs.version-check.outputs.version }}" "tna-frontend-${{ needs.version-check.outputs.version }}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm-cookie-banner:
runs-on: ubuntu-latest
needs:
- publish-npm
- version-check
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org/
scope: '@nationalarchives'
- name: Install dependencies
run: npm ci
- name: Build package
run: ./tasks/cookie-banner/build-cookie-banner-package.sh
- name: Check npm credentials
run: npm whoami
- name: Publish to npm
run: cd package-cookie-banner && npm publish
- name: Rename package directory
run: mv package-cookie-banner "tna-frontend-cookie-banner-${{ needs.version-check.outputs.version }}"
- name: Compress package
run: zip -r "tna-frontend-cookie-banner-${{ needs.version-check.outputs.version }}.zip" "tna-frontend-cookie-banner-${{ needs.version-check.outputs.version }}"
- name: Upload the package to the GitHub release
run: gh release upload "v${{ needs.version-check.outputs.version }}" "tna-frontend-cookie-banner-${{ needs.version-check.outputs.version }}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
notify-slack:
runs-on: ubuntu-latest
needs:
- version-check
- publish-npm-cookie-banner
steps:
- uses: actions/checkout@v4
- name: Get the release notes
id: release-notes
run: |
{
echo 'RELEASE_NOTES<<EOF'
./tasks/get-release-notes.sh ${{ needs.version-check.outputs.version }}
echo EOF
} >> "$GITHUB_OUTPUT"
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: "`v${{ needs.version-check.outputs.version }}` of `tna-frontend` has just been published"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON: "https://raw.githubusercontent.com/nationalarchives/tna-frontend/main/src/nationalarchives/assets/images/apple-touch-icon.png"
MSG_MINIMAL: true
SLACKIFY_MARKDOWN: true
SLACK_MESSAGE: ${{ steps.release-notes.outputs.RELEASE_NOTES }}