Skip to content

Release

Release #289

Workflow file for this run

name: 'Release'
on:
workflow_dispatch:
inputs:
release_type:
type: string
description: 'Release Type: Lerna Auto Versioning if empty.'
required: false
default: ''
prerelease:
type: boolean
description: 'pre-release'
required: false
default: false
snapshot:
type: boolean
description: 'Release as snapshot. This setting has precedence over all other inputs.'
required: false
default: false
jobs:
build:
uses: './.github/workflows/build.yml'
test:
needs: ['build']
uses: './.github/workflows/test.yml'
with:
reportCoverage: false
check-charts-compat-peer-deps:
runs-on: ubuntu-latest
environment: charts-peer-deps-approval
steps:
- name: No-op
run: echo "Did you update the peer dependencies of the charts and compat package?"
release-dryrun:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install
run: |
npm install -g npm
yarn install --immutable
- name: version - Release
if: ${{ github.event.inputs.snapshot == 'false' }}
run: |
${GITHUB_WORKSPACE}/node_modules/.bin/lerna version ${{ github.event.inputs.release_type }} \
${{ (github.event.inputs.prerelease == 'true' && '--conventional-prerelease') || '--conventional-graduate' }} \
--no-push \
--no-git-tag-version
- name: version - Snapshot
if: ${{ github.event.inputs.snapshot == 'true' }}
run: |
git_hash=$(git rev-parse --short "${{ github.sha }}")
${GITHUB_WORKSPACE}/node_modules/.bin/lerna version "0.0.0-${git_hash}" \
--exact \
--no-push \
--no-git-tag-version \
--allow-branch ${{ github.ref_name }}
build-and-release:
needs: ['test', 'release-dryrun', 'check-charts-compat-peer-deps']
runs-on: ubuntu-latest
environment:
name: 'npm'
url: 'https://www.npmjs.com/package/@ui5/webcomponents-react'
permissions:
contents: write
id-token: write
issues: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
token: ${{ secrets.ACCESS_TOKEN }}
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install and build
run: |
npm install -g npm
yarn install --immutable
- name: Setup Git User
run: |
git config user.email ${{ secrets.BOT_GIT_EMAIL }}
git config user.name ${{ secrets.BOT_GIT_USERNAME }}
- name: version - Release
if: ${{ github.event.inputs.snapshot == 'false' }}
run: |
${GITHUB_WORKSPACE}/node_modules/.bin/lerna version ${{ github.event.inputs.release_type }} \
${{ (github.event.inputs.prerelease == 'true' && '--conventional-prerelease') || '--conventional-graduate' }} \
--create-release github
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: version - Snapshot
if: ${{ github.event.inputs.snapshot == 'true' }}
run: |
git_hash=$(git rev-parse --short "${{ github.sha }}")
${GITHUB_WORKSPACE}/node_modules/.bin/lerna version "0.0.0-${git_hash}" \
--exact \
--no-push \
--allow-branch ${{ github.ref_name }}
- name: build
run: yarn build
- name: publish to npm
run: |
${GITHUB_WORKSPACE}/node_modules/.bin/lerna publish from-git ${{ (github.event.inputs.snapshot == 'true' && '--pre-dist-tag dev') || '' }}
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
NPM_CONFIG_PROVENANCE: true
### Semantic Release Bot comments for issues and PRs ###
- name: Add release comments to issues and PRs
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
if: ${{ github.event.inputs.snapshot == 'false' }}
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
github-token: ${{ secrets.ACCESS_TOKEN }}
script: |
const { default: addIssueComments } = await import('${{ github.workspace }}/.github/createIssueCommentsForRelease.mjs');
await addIssueComments({ github, context })