Skip to content

Commit 370df4b

Browse files
authored
Merge pull request #8 from otegami/clone-release-use-release-event-instead-of-workflow-run
Clone release use release event instead of workflow run
2 parents 0d808a6 + 4befd24 commit 370df4b

File tree

4 files changed

+40
-55
lines changed

4 files changed

+40
-55
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

+40-23
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,44 @@
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+
--workflow ${workflow})
26+
if [ -n "${run_id}" ]; then
27+
break
28+
fi
29+
sleep 300
30+
done
31+
gh run watch \
32+
--exit-status \
33+
--interval 300 \
34+
${run_id}
35+
gh run download ${run_id} \
36+
--dir release-artifacts \
37+
--pattern "release-*"
38+
done
39+
env:
40+
GH_TOKEN: ${{ github.token }}
41+
- name: Extract release note
1842
run: |
1943
(cd doc/source/news && \
2044
ruby \
@@ -40,21 +64,14 @@ jobs:
4064
major_version=${version%%.*}
4165
version_hyphen=$(echo ${version} | tr . -)
4266
echo " * [Japanese](https://groonga.org/ja/docs/news/${major_version}.html#release-${version_hyphen})" >> release-note.md
67+
- name: Publish release page
68+
run: |
4369
title="$(head -n1 release-note.md | sed -e 's/^## //')"
4470
tail -n +2 release-note.md > release-note-without-version.md
4571
gh release create "${tag}" \
4672
--discussion-category Releases \
4773
--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/*
74+
--title "${title}" \
75+
release-artifacts/*/*
5976
env:
60-
GH_TOKEN: ${{ secrets.token }}
77+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)