Test (stable; dry-run) #101
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_dispatch: | |
inputs: | |
type: | |
description: Type | |
type: choice | |
required: true | |
default: stable | |
options: | |
- stable | |
- rc | |
- beta | |
- alpha | |
name: | |
description: Name | |
type: string | |
required: true | |
description: | |
description: Description | |
type: string | |
required: false | |
dry-run: | |
description: Dry run? | |
type: boolean | |
required: true | |
default: true | |
run-name: "${{ inputs.name }} (${{ inputs.type }}${{ inputs.dry-run && '; dry-run' || ''}})" | |
permissions: | |
contents: read | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
version: ${{ steps.release.outputs.version }} | |
steps: | |
# Bot cannot sign tags/commits yet | |
# https://github.com/actions/runner/issues/667 | |
- name: Import GPG key | |
id: gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_tag_gpgsign: true | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Node.js | |
uses: ./.github/actions/npm | |
- name: Install PHP | |
if: ${{ !inputs.dry-run }} | |
uses: ./.github/actions/php | |
with: | |
working-directory: dev | |
- name: Release | |
id: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
VERSION="${{ runner.temp }}/VERSION" | |
CHANGELOG="${{ runner.temp }}/CHANGELOG.md" | |
npm run release -- \ | |
${{ inputs.type != 'stable' && format('--preRelease="{0}"', inputs.type) || ''}} \ | |
${{ inputs.dry-run && '--dry-run' || ''}} \ | |
--release.name='${{ inputs.name }}' \ | |
--release.description='${{ inputs.description }}' \ | |
--dump.version="$VERSION" \ | |
--dump.changelog="$CHANGELOG" \ | |
--verbose | |
echo "version=$(cat $VERSION)" >> $GITHUB_OUTPUT | |
cat "$CHANGELOG" >> $GITHUB_STEP_SUMMARY | |
packages: | |
if: ${{ !inputs.dry-run }} | |
uses: ./.github/workflows/packages.yml | |
needs: | |
- release | |
secrets: inherit | |
congrat: | |
name: Congratulations | |
if: ${{ !failure() }} | |
runs-on: ubuntu-latest | |
needs: | |
- release | |
- packages | |
steps: | |
- name: Summary | |
if: ${{ !inputs.dry-run }} | |
run: | | |
echo "Version **[${{ needs.release.outputs.version }}](https://github.com/${{ github.repository }}/releases/tag/${{ needs.release.outputs.version }})** released! :rocket:" >> $GITHUB_STEP_SUMMARY | |
- name: Summary (dry-run) | |
if: ${{ inputs.dry-run }} | |
run: | | |
echo "Version **${{ needs.release.outputs.version }}** will be released! 🔥" >> $GITHUB_STEP_SUMMARY |