Skip to content

Merge pull request #6938 from Sage/FE-6776 #3401

Merge pull request #6938 from Sage/FE-6776

Merge pull request #6938 from Sage/FE-6776 #3401

name: Semantic Release
on:
push:
# These are the branches that we expect to publish from
# semantic-release also has a regex that validates we're running on a release branch
branches:
- master
- "[0-9]+.x"
- "[0-9]+.x.x"
- "[0-9]+.[0-9]+.x"
jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.versionNumber.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: ">=20.9.0 20"
- run: npm ci
- name: Import GPG key
uses: crazy-max/[email protected]
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git-user-signingkey: true
git-commit-gpgsign: true
- run: npx semantic-release
env:
# A personal access token is required to publish from protected branches
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_COMMITTER_NAME: Sage Carbon
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
- id: versionNumber
run: echo "::set-output name=version::$SEMVER_VERSION"
publish:
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.version != null }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: ">=20.9.0 20"
- run: npm ci
- name: Generate metadata file
run: npm run generate-metadata
- run: NODE_ENV=production IGNORE_TESTS=true STORYBOOK_VIEW_MODE=docs npm run build-storybook
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- run: aws s3 sync ./storybook-static/ s3://carbon.sage.com/v/${{needs.release.outputs.version}}
- run: aws s3 sync ./metadata/ s3://carbon.sage.com/metadata