Skip to content

Release

Release #569

Workflow file for this run

name: Release
# Secure execution of continuous integration jobs
# which are performed upon completion of the
# "Continuous Integration" workflow
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
on:
workflow_run:
workflows: ['Continuous Integration']
types: [completed]
branches: [master]
permissions: read-all
jobs:
release:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.conclusion == 'success' &&
(
startsWith(github.event.workflow_run.head_commit.message, 'feat') ||
startsWith(github.event.workflow_run.head_commit.message, 'fix') ||
startsWith(github.event.workflow_run.head_commit.message, 'refactor')
)
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.RELEASE_APP_ID }}
private_key: ${{ secrets.RELEASE_APP_PEM }}
- uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
scope: sbb-esta
- run: yarn install --frozen-lockfile --non-interactive
- name: Run build
run: yarn build
- name: 'Release: Set git user'
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
- name: 'Release: Create release with standard-version'
run: yarn standard-version
- name: 'Release: Push release to repository'
run: git push --follow-tags origin master
- name: 'Release: Determine npm tag'
id: npm_tag
run: |
if [[ "$REF" == *"-"* ]]
then
echo "npm_tag=next" >> $GITHUB_OUTPUT
else
echo "npm_tag=latest" >> $GITHUB_OUTPUT
fi
env:
REF: ${{ github.ref }}
- name: 'Release: Publish @sbb-esta/lyne-design-tokens'
run: yarn publish --tag ${{ steps.npm_tag.outputs.npm_tag }} || true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install netlify CLI
run: yarn global add netlify-cli
- name: Deploy CDN assets
run: ./ci/deploy_cdn_assets.sh
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}