Skip to content

Merge pull request #19 from Jonas-Beck/feat/fetchApi-backstage-token #12

Merge pull request #19 from Jonas-Beck/feat/fetchApi-backstage-token

Merge pull request #19 from Jonas-Beck/feat/fetchApi-backstage-token #12

Workflow file for this run

name: release
on:
push:
branches:
- main
workflow_dispatch: {}
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set git identity
run: |-
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Check whether it's the latest commit
run: if [[ $(git ls-remote origin -h ${{ github.ref }} | cut -f1) != ${{ github.sha }} ]]; then exit 1; fi
- name: Setup Node
uses: actions/[email protected]
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Install build dependencies
run: npm install -g yarn
- name: Install dependencies
run: |
yarn global add @backstage/cli
yarn clean
yarn install --frozen-lockfile
- name: Build
run: |
yarn tsc --jsx react-jsx
yarn build
- name: Push new changelog to git
run: git push --follow-tags
- name: Release to GitHub releases
run: errout=$(mktemp); gh release create $(cat package.json | jq -r .version) -R $GITHUB_REPOSITORY -t $(cat package.json | jq -r .version) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF: ${{ github.ref }}
- name: Release to NPM
run: npm publish --access public