Skip to content

Commit abb56d8

Browse files
authored
OBS-515: Add a workflow to draft a new production release. (#3131)
1 parent 3ce97be commit abb56d8

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/release.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Draft a new production release
2+
3+
on:
4+
workflow_dispatch: {}
5+
6+
jobs:
7+
build:
8+
permissions:
9+
contents: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Draft a new production release
13+
run: |
14+
# Determine tag
15+
base_tag="$(date +v%Y.%m.%d)"
16+
tag="$base_tag"
17+
gh api "repos/${{ github.repository }}/tags" --paginate \
18+
-q '.[].name | select(startswith("'"$tag"'"))' > matching_tags
19+
for i in 1 2 3 4 5 6 7 8 9 error; do
20+
if ! grep -qx "$tag" matching_tags; then
21+
# Tag doesn't exist yet, good to use.
22+
break
23+
fi
24+
if [ "$i" = error ]; then
25+
echo "You've used up your tag budget for today. Try again tomorrow."
26+
exit 1
27+
fi
28+
tag="$base_tag-$i"
29+
done
30+
31+
# Create release
32+
gh release create --repo "${{ github.repository }}" --draft --generate-notes "$tag"
33+
env:
34+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)