1111 required: true
1212
1313permissions:
14- contents: write
14+ contents: read
15+ actions: read
1516
1617jobs:
1718 validate:
@@ -20,43 +21,43 @@ jobs:
2021 outputs:
2122 version: ${{ steps.version.outputs.version }}
2223 is_prerelease: ${{ steps.version.outputs.is_prerelease }}
24+ commit: ${{ steps.version.outputs.commit }}
25+ native: ${{ steps.version.outputs.native }}
2326 steps:
2427 - name: Checkout repository
25- uses: actions/checkout@v4
28+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
29+ with:
30+ fetch-depth: 0
2631
27- - name: Determine version
32+ - name: Resolve existing tag and source version
2833 id: version
34+ env:
35+ REQUEST_TAG: ${{ inputs.tag || github.ref_name }}
2936 run: |
30- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
31- VERSION="${{ github.event.inputs.tag }}"
32- else
33- VERSION="${GITHUB_REF#refs/tags/}"
34- fi
35- VERSION="${VERSION#v}"
36- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
37-
38- if echo "$VERSION" | grep -qE '-(rc|alpha|beta)'; then
39- echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
40- else
41- echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
42- fi
43-
44- echo "Version: $VERSION"
45-
46- - name: Validate version consistency
47- run: |
48- chmod +x scripts/validate-version.sh
49- scripts/validate-version.sh "${{ steps.version.outputs.version }}"
37+ python3 - <<'PYTHON'
38+ import os,re,subprocess
39+ from pathlib import Path
40+ version=os.environ['REQUEST_TAG']
41+ if not re.fullmatch(r'[0-9]+\.[0-9]+\.[0-9]+(?:-(?:rc|alpha|beta)[0-9]+)?',version): raise SystemExit('invalid version tag')
42+ commit=subprocess.check_output(['git','rev-parse','--verify','refs/tags/'+version+'^{commit}'],text=True).strip()
43+ subprocess.run(['git','checkout','--detach',commit],check=True)
44+ subprocess.run(['bash','scripts/validate-version.sh',version],check=True)
45+ native='true' if 'libhttpserver_v3core_la_SOURCES' in Path('src/Makefile.am').read_text() else 'false'
46+ with open(os.environ['GITHUB_OUTPUT'],'a') as out:
47+ out.write('version='+version+'\ncommit='+commit+'\nnative='+native+'\nis_prerelease='+str('-' in version).lower()+'\n')
48+ PYTHON
5049
5150 - name: Extract release notes
51+ env:
52+ VERSION: ${{ steps.version.outputs.version }}
5253 run: |
5354 chmod +x scripts/extract-release-notes.sh
54- scripts/extract-release-notes.sh "${{ steps.version.outputs.version }} " > release-notes.md
55+ scripts/extract-release-notes.sh "$VERSION " > release-notes.md
5556 echo "--- Release notes ---"
5657 cat release-notes.md
5758
5859 - name: Upload release notes
59- uses: actions/upload-artifact@v4
60+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
6061 with:
6162 name: release-notes
6263 path: release-notes.md
6566 name: Build distribution tarball
6667 runs-on: ubuntu-latest
6768 needs: validate
69+ if: needs.validate.outputs.native == 'false'
6870 steps:
6971 - name: Checkout repository
70- uses: actions/checkout@v4
72+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
73+ with:
74+ ref: ${{ needs.validate.outputs.commit }}
7175
7276 - name: Install dependencies
7377 run: |
8993 make dist
9094
9195 - name: Upload tarball
92- uses: actions/upload-artifact@v4
96+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
9397 with:
9498 name: dist-tarball
9599 path: build/libhttpserver-*.tar.gz
@@ -105,7 +109,7 @@ jobs:
105109 sudo apt-get install -y libcurl4-openssl-dev
106110
107111 - name: Download tarball
108- uses: actions/download-artifact@v4
112+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
109113 with:
110114 name: dist-tarball
111115
@@ -135,7 +139,7 @@ jobs:
135139
136140 - name: Fetch curl from cache
137141 id: cache-curl
138- uses: actions/cache@v4
142+ uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
139143 with:
140144 path: curl-7.75.0
141145 key: macos-latest-CURL-pre-built-v3
@@ -155,7 +159,7 @@ jobs:
155159 sudo make install
156160
157161 - name: Download tarball
158- uses: actions/download-artifact@v4
162+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
159163 with:
160164 name: dist-tarball
161165
@@ -184,7 +188,7 @@ jobs:
184188 shell: msys2 {0}
185189 steps:
186190 - name: Setup MSYS2
187- uses: msys2/setup-msys2@v2
191+ uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c
188192 with:
189193 msystem: MINGW64
190194 update: true
@@ -197,7 +201,7 @@ jobs:
197201 pacman --noconfirm -S --needed mingw-w64-x86_64-{toolchain,libtool,make,pkg-config,libsystre,doxygen,graphviz,curl,python}
198202
199203 - name: Download tarball
200- uses: actions/download-artifact@v4
204+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
201205 with:
202206 name: dist-tarball
203207
@@ -221,24 +225,27 @@ jobs:
221225 name: Create GitHub Release
222226 runs-on: ubuntu-latest
223227 needs: [validate, verify-dist-linux, verify-dist-macos, verify-dist-windows]
228+ if: needs.validate.outputs.native == 'false'
229+ permissions:
230+ contents: write
224231 steps:
225232 - name: Download tarball
226- uses: actions/download-artifact@v4
233+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
227234 with:
228235 name: dist-tarball
229236
230237 - name: Download release notes
231- uses: actions/download-artifact@v4
238+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
232239 with:
233240 name: release-notes
234241
235242 - name: Create release
236243 env:
237244 GH_TOKEN: ${{ github.token }}
238245 GH_REPO: ${{ github.repository }}
246+ VERSION: ${{ needs.validate.outputs.version }}
247+ IS_PRERELEASE: ${{ needs.validate.outputs.is_prerelease }}
239248 run: |
240- VERSION="${{ needs.validate.outputs.version }}"
241- IS_PRERELEASE="${{ needs.validate.outputs.is_prerelease }}"
242249
243250 PRERELEASE_FLAG=""
244251 if [ "$IS_PRERELEASE" = "true" ]; then
@@ -250,3 +257,15 @@ jobs:
250257 --notes-file release-notes.md \
251258 $PRERELEASE_FLAG \
252259 libhttpserver-*.tar.gz
260+
261+ v3-acceptance:
262+ needs: validate
263+ if: needs.validate.outputs.native == 'true'
264+ permissions:
265+ contents: write
266+ actions: read
267+ uses: ./.github/workflows/v3-release-acceptance.yml
268+ with:
269+ source_commit: ${{ needs.validate.outputs.commit }}
270+ source_version: ${{ needs.validate.outputs.version }}
271+ publication: true
0 commit comments