ci: use release app token permissions for release workflow

This commit is contained in:
Bassel Kanso 2025-01-28 12:41:58 +02:00
parent bffd3c1819
commit bd209139a4
3 changed files with 11 additions and 7 deletions

View File

@ -10,16 +10,21 @@ on:
- patch - patch
- minor - minor
permissions:
contents: write
jobs: jobs:
publish: publish:
name: 'Publish' name: 'Publish'
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'strapi/strapi' if: github.repository == 'strapi/strapi'
steps: steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.RELEASE_APP_ID }}
private-key: ${{ secrets. RELEASE_APP_SECRET }}
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0 # Fetch full history
- name: Setup npmrc - name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
@ -30,5 +35,5 @@ jobs:
env: env:
VERSION: ${{ github.event.inputs.version }} VERSION: ${{ github.event.inputs.version }}
DIST_TAG: 'latest' DIST_TAG: 'latest'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GITHUB_ACTOR: ${{ github.actor }} GITHUB_ACTOR: ${{ github.actor }}

View File

@ -24,7 +24,7 @@ if [[ -z "$GITHUB_TOKEN" ]]; then
exit 1 exit 1
fi fi
# Configure Git for bot commits # Configure Git
git config --global user.name "${GITHUB_ACTOR}" git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"

View File

@ -67,7 +67,6 @@ const yargs = require('yargs');
dryRun: options.dryRun, dryRun: options.dryRun,
verbose: options.verbose, verbose: options.verbose,
gitCommit: options.gitCommit, gitCommit: options.gitCommit,
gitTag: options.gitTag,
preid: options.preid, preid: options.preid,
}); });
@ -78,7 +77,7 @@ const yargs = require('yargs');
dryRun: options.dryRun, dryRun: options.dryRun,
verbose: options.verbose, verbose: options.verbose,
gitCommit: false, gitCommit: false,
gitTag: false, gitTag: options.gitTag,
}); });
} }
} }