Skip to content

Commit b30dfae

Browse files
committed
ci release: switch release workflow trigger from workflow_call to tag push event
This PR changes our release workflow trigger from using workflow_call to a push event (tag push). The motivations are as follows. Automate pushing to Launchpad: Similar to mroonga/mroonga’s release workflow. we want to embed steps to automate pushing to Launchpad. Using release workflow simplifies passing secrets and necessary inputs. ref: https://docs.github.com/en/actions/sharing-automations/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow Improve maintainability and consistency: Related projects such as PGroonga and Mroonga have adopted the release event approach. Aligning our process improves overall maintainability and unifies our release strategy.
1 parent 0d808a6 commit b30dfae

File tree

4 files changed

+45
-58
lines changed

4 files changed

+45
-58
lines changed

.github/workflows/cmake.yml

-11
Original file line numberDiff line numberDiff line change
@@ -883,14 +883,3 @@ jobs:
883883
--timeout 360 `
884884
--use-http-chunked `
885885
test\command\suite
886-
887-
release:
888-
if: |
889-
github.ref_type == 'tag'
890-
name: Release for Windows MSVC
891-
needs: windows-msvc
892-
uses: ./.github/workflows/release.yml
893-
with:
894-
tag: ${{ github.ref_name }}
895-
secrets:
896-
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/document.yml

-10
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,3 @@ jobs:
6767
with:
6868
name: release-document
6969
path: document-*.tar.gz
70-
release:
71-
if: |
72-
github.ref_type == 'tag'
73-
name: Release
74-
needs: build
75-
uses: ./.github/workflows/release.yml
76-
with:
77-
tag: ${{ github.ref_name }}
78-
secrets:
79-
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/package.yml

-11
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,3 @@ jobs:
308308
with:
309309
name: release-linux-packages
310310
path: "*.tar.gz"
311-
312-
release:
313-
if: |
314-
github.ref_type == 'tag'
315-
name: Release
316-
needs: prepare-for-release
317-
uses: ./.github/workflows/release.yml
318-
with:
319-
tag: ${{ github.ref_name }}
320-
secrets:
321-
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

+45-26
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,47 @@
11
name: Release
22
on:
3-
workflow_call:
4-
inputs:
5-
tag:
6-
required: true
7-
type: string
8-
secrets:
9-
token:
10-
required: true
3+
push:
4+
tags:
5+
- "*"
116
jobs:
12-
page:
13-
name: Release Page
7+
publish:
8+
name: Publish
149
runs-on: ubuntu-latest
10+
timeout-minutes: 60
1511
steps:
1612
- uses: actions/checkout@v4
17-
- name: Create release page
13+
- name: Download artifacts
14+
run: |
15+
workflows=(cmake.yml document.yml package.yml)
16+
for workflow in "${workflows[@]}"; do
17+
run_id=""
18+
while true; do
19+
echo "Waiting for run to start ${workflow}..."
20+
run_id=$(gh run list \
21+
--branch ${GITHUB_REF_NAME} \
22+
--jq '.[].databaseId' \
23+
--json databaseId \
24+
--limit 1 \
25+
--repo ${GITHUB_REPOSITORY} \
26+
--workflow ${workflow})
27+
if [ -n "${run_id}" ]; then
28+
break
29+
fi
30+
sleep 300
31+
done
32+
gh run watch \
33+
--exit-status \
34+
--interval 300 \
35+
--repo ${GITHUB_REPOSITORY} \
36+
${run_id}
37+
gh run download ${run_id} \
38+
--dir release-artifacts \
39+
--pattern "release-*" \
40+
--repo ${GITHUB_REPOSITORY}
41+
done
42+
env:
43+
GH_TOKEN: ${{ github.token }}
44+
- name: Extract release note
1845
run: |
1946
(cd doc/source/news && \
2047
ruby \
@@ -35,26 +62,18 @@ jobs:
3562
echo "" >> release-note.md
3663
echo "### Translations" >> release-note.md
3764
echo "" >> release-note.md
38-
tag=${{ inputs.tag }}
39-
version=${tag#v}
65+
version=${GITHUB_REF_NAME#v}
4066
major_version=${version%%.*}
4167
version_hyphen=$(echo ${version} | tr . -)
4268
echo " * [Japanese](https://groonga.org/ja/docs/news/${major_version}.html#release-${version_hyphen})" >> release-note.md
69+
- name: Publish release page
70+
run: |
4371
title="$(head -n1 release-note.md | sed -e 's/^## //')"
4472
tail -n +2 release-note.md > release-note-without-version.md
45-
gh release create "${tag}" \
73+
gh release create "${GITHUB_REF_NAME}" \
4674
--discussion-category Releases \
4775
--notes-file release-note-without-version.md \
48-
--title "${title}" || :
49-
env:
50-
GH_TOKEN: ${{ secrets.token }}
51-
- uses: actions/download-artifact@v4
52-
with:
53-
path: artifacts
54-
pattern: release-*
55-
merge-multiple: true
56-
- name: Upload to release
57-
run: |
58-
gh release upload "${{ inputs.tag }}" artifacts/*
76+
--title "${title}" \
77+
release-artifacts/*/*
5978
env:
60-
GH_TOKEN: ${{ secrets.token }}
79+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)