v0.1.33 #46
Workflow file for this run
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
name: Publish release | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
check: | |
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-package: | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Test build package | |
uses: ./.github/actions/test-package | |
prototype-kit: | |
runs-on: ubuntu-latest | |
needs: | |
- test-package | |
steps: | |
- uses: actions/checkout@v3 | |
- name: GOV.UK prototype kit test | |
uses: ./.github/actions/prototype-kit-test | |
publish-npm: | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
- lint | |
- tests | |
- 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 "tna-frontend-${{ needs.check.outputs.version }}" | |
- name: Compress package | |
run: zip -r "tna-frontend-${{ needs.check.outputs.version }}.zip" "tna-frontend-${{ needs.check.outputs.version }}" | |
- name: Upload the package to the GitHub release | |
run: gh release upload "v${{ needs.check.outputs.version }}" "tna-frontend-${{ needs.check.outputs.version }}.zip" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-npm-cookie-banner: | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
- lint | |
- tests | |
- prototype-kit | |
- publish-npm | |
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-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 "tna-frontend-cookie-banner-${{ needs.check.outputs.version }}" | |
- name: Compress package | |
run: zip -r "tna-frontend-cookie-banner-${{ needs.check.outputs.version }}.zip" "tna-frontend-cookie-banner-${{ needs.check.outputs.version }}" | |
- name: Upload the package to the GitHub release | |
run: gh release upload "v${{ needs.check.outputs.version }}" "tna-frontend-cookie-banner-${{ needs.check.outputs.version }}.zip" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
notify-slack: | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
- publish-npm | |
- publish-npm-cookie-banner | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get release notes | |
id: get-release-notes | |
run: ./tasks/get-release-notes.sh "${{ needs.check.outputs.version }}" > RELEASE_NOTES.txt | |
- uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_TITLE: "`v${{ needs.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" |