release #31
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: release | |
on: | |
workflow_run: | |
workflows: [pre-commit] | |
types: [completed] | |
branches: [master] | |
jobs: | |
semantic-release: | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
runs-on: ubuntu-latest | |
container: | |
image: goreleaser/goreleaser | |
env: | |
NPM_CACHE_DIR: ~/.cache/npm | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_FINGERPRINT: ${{ secrets.FINGERPRINT }} | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Install job dependencies | |
run: apk add tar git gpg gpg-agent nodejs npm sed | |
- name: Import GPG key | |
run: | | |
echo -n "${{ secrets.GPG_PRIVATE_KEY }}" > key.gpg | |
echo "${{ secrets.PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --import key.gpg | |
echo "allow-preset-passphrase" > $HOME/.gnupg/gpg-agent.conf | |
gpgconf --reload gpg-agent | |
HEXPASSWD=$(echo -n "${{ secrets.PASSPHRASE }}" | hexdump -v -e '/1 "%02X"') | |
gpg-connect-agent "preset_passphrase ${{ secrets.KEYGRIP }} -1 $HEXPASSWD" /bye | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache | |
key: semantic-release | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Calm git | |
run: git config --global --add safe.directory $PWD | |
- name: Install semantic-release and plugins | |
run: npm install --cache $NPM_CACHE_DIR | |
semantic-release | |
@semantic-release/github | |
@semantic-release/changelog | |
@semantic-release/git | |
@semantic-release/exec | |
conventional-changelog-conventionalcommits | |
- name: Run semantic-release | |
run: | | |
npx semantic-release |