feat!(deps): update renovatebot/github-action to v41 #4315
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: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: 'bash -Eeuxo pipefail {0}' | |
jobs: | |
setup: | |
name: Setup | |
outputs: | |
dist-changed: ${{ contains(steps.filter.outputs.changes, 'dist-changed') }} | |
node-version: ${{ steps.set-node-version.outputs.node-version }} | |
should-lint: ${{ contains(steps.filter.outputs.changes, 'should-lint') }} | |
src-changed: ${{ contains(steps.filter.outputs.changes, 'src-changed') }} | |
permissions: | |
pull-requests: read | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Enable corepack | |
run: corepack enable | |
- id: set-node-version | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
cache: pnpm | |
node-version-file: '.node-version' | |
- run: pnpm install --frozen-lockfile --ignore-scripts | |
- id: filter | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
with: | |
filters: | | |
config: &config | |
- .github/** | |
- .node-version | |
- .npmrc | |
- eslint.config.js | |
- '**.json5?' | |
- '**.md' | |
- '**.yaml' | |
- '**.yml' | |
dist-changed: | |
- added|modified: 'dist/**' | |
src-changed: &src-changed | |
- .github/workflows/** | |
- .node-version | |
- .npmrc | |
- __tests__/** | |
- docker/** | |
- src/** | |
- action.yaml | |
- package.json | |
- pnpm-lock.yaml | |
- tsconfig.json | |
should-lint: | |
- added|modified: *config | |
- added|modified: *src-changed | |
lint: | |
if: ${{ needs.setup.outputs.should-lint == 'true' }} | |
name: Lint | |
needs: [setup] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
cache: pnpm | |
node-version: ${{ needs.setup.outputs.node-version }} | |
- run: pnpm install --frozen-lockfile --ignore-scripts | |
- run: pnpm lint | |
build: | |
if: ${{ github.event_name == 'push' || needs.setup.outputs.src-changed == 'true' }} | |
name: Build | |
needs: [setup] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
cache: pnpm | |
node-version: ${{ needs.setup.outputs.node-version }} | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --ignore-scripts | |
- name: Rebuild the dist/ directory | |
run: pnpm build-release | |
- if: ${{ needs.setup.outputs.dist-changed == 'true' }} | |
name: Compare the expected and actual dist/ directories | |
run: | | |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | |
echo "Detected uncommitted changes after build. See status below:" | |
git diff --text | |
exit 1 | |
fi | |
id: diff | |
# If index.js was different than expected, upload the expected version as an artifact | |
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
if: ${{ failure() && steps.diff.conclusion == 'failure' }} | |
with: | |
name: dist | |
path: dist/ | |
test: | |
name: Test | |
needs: [setup] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
cache: pnpm | |
node-version: ${{ needs.setup.outputs.node-version }} | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --ignore-scripts | |
- run: pnpm test | |
- if: ${{ github.repository_owner == 'bfra-me' && github.ref_name != github.event.repository.default_branch }} | |
uses: ./ | |
with: | |
dry-run: true | |
log-level: debug | |
renovate-app-id: ${{ secrets.APPLICATION_ID }} | |
renovate-app-private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }} | |
release: | |
env: | |
DRY_RUN: ${{ github.ref_name != github.event.repository.default_branch }} | |
RELEASE_BRANCH: release | |
name: Release | |
needs: [setup, lint, test, build] | |
outputs: | |
commit: ${{ steps.merge.outputs.commit }} | |
version: ${{ steps.semantic-release.outputs.version }} | |
permissions: | |
contents: write | |
id-token: write | |
issues: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- id: get-app-token | |
name: Get GitHub App Installation Token | |
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 | |
with: | |
app-id: ${{ secrets.APPLICATION_ID }} | |
private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }} | |
- id: get-user-id | |
name: Get GitHub App User ID and Setup Git user | |
env: | |
GH_TOKEN: ${{ steps.get-app-token.outputs.token }} | |
run: | | |
name="${{ steps.get-app-token.outputs.app-slug }}[bot]" | |
user_id=$(gh api "/users/${name}" --jq .id) | |
email="${user_id}+${name}@users.noreply.github.com" | |
echo "user-email=${email}" >> "$GITHUB_OUTPUT" | |
echo "user-name=${name}" >> "$GITHUB_OUTPUT" | |
git config --global user.email "${email}" | |
git config --global user.name "${name}" | |
- name: Checkout `${{ env.RELEASE_BRANCH }}` release branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
filter: blob:none | |
ref: ${{ env.RELEASE_BRANCH }} | |
show-progress: false | |
token: ${{ steps.get-app-token.outputs.token }} | |
- if: ${{ github.event_name == 'pull_request' }} | |
name: Fetch PR | |
run: git fetch origin +${{ github.sha }}:${{ github.ref }} | |
- id: merge | |
name: Merge `main` into `${{ env.RELEASE_BRANCH }}` release | |
run: | | |
git merge --no-ff -Xtheirs -m 'skip: merge (${{ github.sha }}) [skip release]' ${{ github.sha }} | |
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- if: env.DRY_RUN != 'true' | |
name: Push `${{ env.RELEASE_BRANCH }}` branch | |
run: git push origin ${{ env.RELEASE_BRANCH }}:${{ env.RELEASE_BRANCH }} | |
- name: Enable corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
cache: pnpm | |
node-version: ${{ needs.setup.outputs.node-version }} | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- if: env.DRY_RUN != 'true' | |
name: Build release | |
run: pnpm build-release | |
- name: Semantic Release | |
id: semantic-release | |
env: | |
GIT_AUTHOR_EMAIL: ${{ steps.get-user-id.outputs.user-email }} | |
GIT_AUTHOR_NAME: ${{ steps.get-user-id.outputs.user-name }} | |
GIT_COMMITTER_EMAIL: ${{ steps.get-user-id.outputs.user-email }} | |
GIT_COMMITTER_NAME: ${{ steps.get-user-id.outputs.user-name }} | |
GITHUB_TOKEN: ${{ steps.get-app-token.outputs.token }} | |
LOG_LEVEL: debug | |
run: | | |
export GITHUB_REF=refs/heads/${{ env.RELEASE_BRANCH }} GITHUB_SHA=${{ steps.merge.outputs.commit }} | |
pnpm semantic-release --dry-run ${{ env.DRY_RUN }} --ci ${{ env.DRY_RUN != 'true' }} | |
- 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-app-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 |