Skip to content

Commit

Permalink
ci deploy: release add deploy workflow to notify successful package u…
Browse files Browse the repository at this point in the history
…pload

GitHub: groonga/packages.groonga.org#43

This PR introduces a new release workflow. This release workflow
handdle the followings. We will implement it step by step.

- Create release page <- This PR is here.
- Upload the release artifacts to release page
  • Loading branch information
otegami committed Dec 17, 2024
1 parent f2db1e3 commit 553705c
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 34 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/document.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ jobs:
run: gh release upload ${{ github.ref_name }} document-*.tar.gz
env:
GH_TOKEN: ${{ github.token }}
release:
if: |
github.ref_type == 'tag'
needs: build
uses: ./.github/workflows/release.yml
with:
tag: ${{ github.ref_name }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
# todo: Documents generated by Doxygen are also built with CMake.
doxygen:
name: Doxygen
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,13 @@ jobs:
--volume ${PWD}:/groonga:ro \
${TEST_DOCKER_IMAGE} \
/groonga/packages/${TASK_NAMESPACE}/test.sh
release:
if: |
github.ref_type == 'tag'
needs: build
uses: ./.github/workflows/release.yml
with:
tag: ${{ github.ref_name }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
79 changes: 45 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,54 @@
name: Release
on:
push:
tags:
- '*'
workflow_call:
inputs:
tag:
required: true
type: string
secrets:
token:
required: true
jobs:
page:
steps:
- uses: actions/checkout@v4
- name: Create release page
run: |
(cd doc/source/news && \
ruby \
-e 'print("## Groonga "); \
puts(ARGF.read.split(/^## Release /)[1]. \
gsub(/^\(.+\)=$/, ""). \
gsub(/{doc}`(.+?)`/) { \
id = $1; \
title = id.split("\/").last; \
path = id.delete_prefix("/"); \
url = "https://groonga.org/docs/#{path}.html"; \
"[#{title}](#{url})"; \
}. \
gsub(/{ref}`(.+?)`/) {$1}.
strip)' \
$(ls *.md | sort --human-numeric-sort | tail -n1)) > \
release-note.md
echo "" >> release-note.md
echo "### Translations" >> release-note.md
echo "" >> release-note.md
version=${GITHUB_REF_NAME#v}
major_version=${version%%.*}
version_hyphen=$(echo ${version} | tr . -)
echo " * [Japanese](https://groonga.org/ja/docs/news/${major_version}.html#release-${version_hyphen})" >> release-note.md
title="$(head -n1 release-note.md | sed -e 's/^## //')"
tail -n +2 release-note.md > release-note-without-version.md
gh release create ${GITHUB_REF_NAME} \
--discussion-category Releases \
--notes-file release-note-without-version.md \
--title "${title}"
if gh release view "${{ inputs.tag }}" > /dev/null 2>&1; then
echo "Skip the creation step for Release ${{ inputs.tag }}."
else
gh release create "${{ inputs.tag }}" \
--title "release-${{ inputs.tag }}"
(cd doc/source/news && \
ruby \
-e 'print("## Groonga "); \
puts(ARGF.read.split(/^## Release /)[1]. \
gsub(/^\(.+\)=$/, ""). \
gsub(/{doc}`(.+?)`/) { \
id = $1; \
title = id.split("\/").last; \
path = id.delete_prefix("/"); \
url = "https://groonga.org/docs/#{path}.html"; \
"[#{title}](#{url})"; \
}. \
gsub(/{ref}`(.+?)`/) {$1}.
strip)' \
$(ls *.md | sort --human-numeric-sort | tail -n1)) > \
release-note.md
echo "" >> release-note.md
echo "### Translations" >> release-note.md
echo "" >> release-note.md
version=${{ inputs.tag#v }}
major_version=${version%%.*}inputs.tag
version_hyphen=$(echo ${version} | tr . -)
echo " * [Japanese](https://groonga.org/ja/docs/news/${major_version}.html#release-${version_hyphen})" >> release-note.md
title="$(head -n1 release-note.md | sed -e 's/^## //')"
tail -n +2 release-note.md > release-note-without-version.md
gh release create ${{ inputs.tag }} \
z--discussion-category Releases \
--notes-file release-note-without-version.md \
--title "${title}"
fi
env:
GH_TOKEN: ${{ github.token }}

GH_TOKEN: ${{ secrets.token }
# todo: donwload uploaded artifacts from caller workflow and upload them to release page.

0 comments on commit 553705c

Please sign in to comment.