Skip to content

Manual Release @scania/tegel-react #32

Manual Release @scania/tegel-react

Manual Release @scania/tegel-react #32

Workflow file for this run

name: Manual Release @scania/tegel-react
on:
workflow_dispatch:
inputs:
nodeVersion:
description: 'Node version'
required: true
default: '20.9.0'
type: string
tags:
description: 'Tag'
required: true
default: 'latest'
type: choice
options:
- latest
- beta
- dev
dryRun:
description: 'Dry run'
required: false
default: false
type: boolean
jobs:
release-react:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: develop
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: ${{ github.event.inputs.nodeVersion }}
registry-url: 'https://registry.npmjs.org'
- name: Set Tegel user
run: git config --global user.name "Tegel - Scania" && git config --global user.email "[email protected]"
- name: React - Read package.json Version
id: version
working-directory: packages/react
run: echo "PACKAGE_VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
- name: Install dependencies in root
run: npm install
- name: Core - Install
working-directory: packages/core
run: npm install
- name: React - Install
working-directory: packages/react
run: npm install
- name: React - Install with latest tegel package
working-directory: packages/react
run: npm install @scania/tegel@${{ steps.version.outputs.PACKAGE_VERSION }}
- name: React - Build
run: npm run build-react
- name: React - Publish
run: |
if [ "${{ github.event.inputs.dryRun }}" == "true" ]; then
npm publish --tag ${{ github.event.inputs.tags }} --dry-run
else
npm publish --tag ${{ github.event.inputs.tags }}
fi
working-directory: packages/react
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
outputs:
version: ${{ steps.version.outputs.PACKAGE_VERSION }}
on-failure:
needs: release-react
runs-on: ubuntu-latest
if: always() && needs.release-react.result == 'failure'
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: develop
- name: Remove git tag on failure
run: |
tagname="@scania/tegel@${{ needs.release-react.outputs.version }}"
if git rev-parse $tagname >/dev/null 2>&1; then
git push --no-verify --delete origin $tagname
fi