-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (101 loc) · 3.01 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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