-
Notifications
You must be signed in to change notification settings - Fork 5
80 lines (69 loc) · 2.14 KB
/
automated-release.yml
File metadata and controls
80 lines (69 loc) · 2.14 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Automated Weekly Release
on:
schedule:
- cron: "0 10 * * 4" # Every Thursday at 10 AM UTC
workflow_dispatch:
permissions:
contents: write
pull-requests: write
checks: write
concurrency:
group: create-release-tag
cancel-in-progress: false
jobs:
check-changes:
name: Check for changes since last release
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.check.outputs.has_changes }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
token: ${{ secrets.PRO_ACCESS_TOKEN }}
- name: Fetch tags
run: git fetch --tags --force
- name: Check for changes
id: check
run: |
set -euo pipefail
latest_tag="$(git tag --list "v0.*.*" --sort=-v:refname | grep -E "^v0\.[0-9]+\.[0-9]+$" | head -n 1 || true)"
if [[ -z "${latest_tag}" ]]; then
echo "No previous tag found, proceeding with release"
echo "has_changes=true" >> "${GITHUB_OUTPUT}"
else
changes="$(git log "${latest_tag}..HEAD" --oneline)"
if [[ -z "${changes}" ]]; then
echo "No changes since ${latest_tag}, skipping release"
echo "has_changes=false" >> "${GITHUB_OUTPUT}"
else
echo "Changes found since ${latest_tag}, proceeding with release"
echo "has_changes=true" >> "${GITHUB_OUTPUT}"
fi
fi
ci:
name: CI
needs: check-changes
if: needs.check-changes.outputs.has_changes == 'true'
uses: ./.github/workflows/ci.yml
secrets: inherit
create-tag:
name: Create release tag
needs: [check-changes, ci]
if: needs.check-changes.outputs.has_changes == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
token: ${{ secrets.PRO_ACCESS_TOKEN }}
- name: Fetch tags
run: git fetch --tags --force
- name: Create release tag
uses: ./.github/actions/create-release-tag
with:
bump: patch