-
Notifications
You must be signed in to change notification settings - Fork 182
56 lines (50 loc) · 1.65 KB
/
weekly_release.yml
File metadata and controls
56 lines (50 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Weekly Release
on:
schedule:
- cron: '18 7 * * 0'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
- name: Find latest version tag
id: find_tag
run: |
LATEST_TAG=$(git tag --sort=-v:refname --list 'v*' | head -1)
echo "Latest tag: ${LATEST_TAG}"
if [ -z "$LATEST_TAG" ]; then
echo "No version tag found, skipping release."
echo "has_tag=false" >> "$GITHUB_OUTPUT"
else
echo "tag=${LATEST_TAG}" >> "$GITHUB_OUTPUT"
echo "has_tag=true" >> "$GITHUB_OUTPUT"
fi
- name: Check if release already exists
if: steps.find_tag.outputs.has_tag == 'true'
id: check_release
run: |
TAG="${{ steps.find_tag.outputs.tag }}"
if gh release view "$TAG" > /dev/null 2>&1; then
echo "Release for ${TAG} already exists, skipping."
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Create release
if: steps.find_tag.outputs.has_tag == 'true' && steps.check_release.outputs.exists == 'false'
run: |
TAG="${{ steps.find_tag.outputs.tag }}"
# Try with auto-generated notes; fall back to simple notes if body is too long
gh release create "$TAG" --title "$TAG" --generate-notes || \
gh release create "$TAG" --title "$TAG" --notes "Release ${TAG}"
env:
GH_TOKEN: ${{ github.token }}