fix(vendors): simplify the currentValue
capture for npm commands (#…
#3013
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
'on': | |
merge_group: | |
push: | |
branches: [main, 'renovate/**'] | |
pull_request: | |
types: [opened, synchronize, ready_for_review, reopened] | |
workflow_dispatch: | |
inputs: | |
dry_run: | |
description: 'Dry run' | |
default: false | |
required: false | |
type: boolean | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
release: | |
env: | |
DRY_RUN: ${{ github.event_name == 'pull_request' || github.event.inputs.dry_run && 'true' || 'false' }} | |
FORCE_COLOR: true | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Workflow Access Token | |
id: get-workflow-access-token | |
uses: peter-murray/workflow-application-token-action@dc0413987a085fa17d19df9e47d4677cf81ffef3 # v3.0.0 | |
with: | |
application_id: ${{ secrets.APPLICATION_ID }} | |
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.get-workflow-access-token.outputs.token }} | |
- name: Setup Node.js | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version-file: '.node-version' | |
- name: Get Release Options | |
env: | |
IS_DEFAULT_BRANCH: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
run: | | |
if [[ $DRY_RUN != 'true' || $IS_DEFAULT_BRANCH == 'true' ]]; then | |
echo "DRY_RUN=false" >> $GITHUB_ENV | |
fi | |
- name: Semantic Release | |
id: semantic-release | |
env: | |
CI_FLAG: ${{ env.DRY_RUN == 'true' && 'false' || 'true' }} | |
GIT_AUTHOR_EMAIL: '118100583+bfra-me[bot]@users.noreply.github.com' | |
GIT_AUTHOR_NAME: 'bfra-me[bot]' | |
GIT_COMMITTER_EMAIL: '118100583+bfra-me[bot]@users.noreply.github.com' | |
GIT_COMMITTER_NAME: 'bfra-me[bot]' | |
GITHUB_TOKEN: ${{ steps.get-workflow-access-token.outputs.token }} | |
run: | | |
# Run `semantic-release` | |
npm install conventional-changelog-conventionalcommits@8.0.0 | |
npm install semantic-release-export-data@1.0.1 | |
npx semantic-release@24.0.0 --dry-run ${{ env.DRY_RUN }} --ci ${{ env.CI_FLAG }} | |
- name: Push Release Branch To Major Branch | |
if: ${{ env.DRY_RUN != 'true' && steps.semantic-release.outputs.new-release-published == 'true' }} | |
env: | |
GH_REPO: ${{ github.repository }} | |
GH_TOKEN: ${{ steps.get-workflow-access-token.outputs.token }} | |
run: | | |
# Update the major branch reference to the new release tag | |
version=${{ steps.semantic-release.outputs.new-release-version }} | |
sha=$(git rev-parse HEAD) | |
branch_name=v$(echo ${version} | cut -d . -f 1) | |
ref=refs/heads/${branch_name} | |
if [[ "$(gh api repos/{owner}/{repo}/git/ref/heads/${branch_name} 2>&1)" =~ "Not Found" ]]; then | |
gh api -X POST repos/{owner}/{repo}/git/refs -f ref=${ref} -f sha=$sha | |
else | |
gh api -X PATCH repos/{owner}/{repo}/git/${ref} -f sha=$sha -F force=true | |
fi |