Skip to content

Commit 03ab6fc

Browse files
authored
Merge pull request #3375 from eseiler/infra/draft_release
[INFRA] Draft release on tag
2 parents 54ed387 + ae192ad commit 03ab6fc

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2+
# SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
name: Draft Release
6+
7+
on:
8+
push:
9+
tags:
10+
- '*'
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: draft-release-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
TZ: Europe/Berlin
19+
20+
defaults:
21+
run:
22+
shell: bash -Eeuxo pipefail {0}
23+
24+
jobs:
25+
build:
26+
name: Create
27+
runs-on: ubuntu-latest
28+
if: github.repository_owner == 'seqan'
29+
container:
30+
image: ghcr.io/seqan/gcc-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v5
34+
with:
35+
token: ${{ secrets.SEQAN_ACTIONS_PAT }}
36+
path: seqan3
37+
38+
- name: Create packages
39+
run: |
40+
mkdir package && cd package
41+
cmake ../seqan3
42+
cpack
43+
make package_source
44+
45+
- name: Create draft release
46+
working-directory: package
47+
env:
48+
GH_TOKEN: ${{ secrets.SEQAN_ACTIONS_PAT }}
49+
GH_REPO: ${{ github.repository }}
50+
run: |
51+
LATEST_RELEASE=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/seqan/seqan3/releases/latest --jq '.tag_name')
52+
if [[ "${{ github.ref_name }}" =~ "-rc" ]]; then
53+
NEXT_RELEASE=$(echo "${{ github.ref_name }}" | cut -f 1 -d '-')
54+
LATEST_RC=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/seqan/seqan3/releases --jq 'first(.[]|select(.tag_name | contains("-rc") and contains("'${NEXT_RELEASE}'"))).tag_name')
55+
else
56+
LATEST_RC=""
57+
fi
58+
59+
BODY="[![GitHub commits since latest release][version_diff_badge_latest_release]][version_diff_commits_latest_release]"
60+
if [[ -n "${LATEST_RC}" ]]; then
61+
BODY+=" [![GitHub commits since latest release candidate][version_diff_badge_latest_rc]][version_diff_commits_latest_rc]"
62+
fi
63+
BODY+="\n\n"
64+
BODY+="[version_diff_badge_latest_release]: https://img.shields.io/github/commits-since/seqan/seqan3/${LATEST_RELEASE}/${{ github.ref_name }} \"Click to view commits\"\n"
65+
BODY+="[version_diff_commits_latest_release]: https://github.com/seqan/seqan3/compare/${LATEST_RELEASE}...${{ github.ref_name }}\n"
66+
if [[ -n "${LATEST_RC}" ]]; then
67+
BODY+="[version_diff_badge_latest_rc]: https://img.shields.io/github/commits-since/seqan/seqan3/${LATEST_RC}/${{ github.ref_name }} \"Click to view commits\"\n"
68+
BODY+="[version_diff_commits_latest_rc]: https://github.com/seqan/seqan3/compare/${LATEST_RC}...${{ github.ref_name }}\n"
69+
fi
70+
BODY+="Release ${{ github.ref_name }}"
71+
echo -e "${BODY}" > tmp.md
72+
73+
gh release create ${{ github.ref_name }} seqan3-${{ github.ref_name }}* \
74+
--verify-tag \
75+
--draft \
76+
--title "${{ github.ref_name }}" \
77+
--generate-notes \
78+
--notes-start-tag ${LATEST_RC:-${LATEST_RELEASE}} \
79+
--notes-file tmp.md
80+

0 commit comments

Comments
 (0)