forked from beakthoven/TrickyStoreOSS
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (97 loc) · 3.28 KB
/
Copy pathrelease.yml
File metadata and controls
113 lines (97 loc) · 3.28 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Release
on:
push:
tags:
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- name: Check out
uses: actions/checkout@v7
with:
submodules: "recursive"
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: 26
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ccache-${{ runner.os }}-release
restore-keys: |
ccache-${{ runner.os }}-release
ccache-${{ runner.os }}-
ccache-
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6.3.0
- name: Build release
run: ./gradlew --parallel assembleRelease --stacktrace
- name: Resolve release zip
id: zip
run: |
ZIP=$(find out -name "*Release*.zip" | head -1)
if [ -z "$ZIP" ]; then
echo "::error::No Release zip produced"
exit 1
fi
echo "path=$ZIP" >> "$GITHUB_OUTPUT"
echo "name=$(basename "$ZIP")" >> "$GITHUB_OUTPUT"
- name: Attest build provenance
uses: actions/attest@v4
with:
subject-path: ${{ steps.zip.outputs.path }}
- name: Generate release notes
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || true)
{
echo "## Commits"
echo
if [ -n "$PREV_TAG" ]; then
git log "$PREV_TAG..HEAD" --pretty='- %s (%h)'
else
git log --pretty='- %s (%h)'
fi
} > notes.md
if [ -n "$PREV_TAG" ]; then
SINCE=$(gh release view "$PREV_TAG" --json publishedAt --jq '.publishedAt[:10]' || git log -1 --format=%cs "$PREV_TAG")
CLOSED=$(gh api -X GET search/issues -f "q=repo:$REPO is:issue closed:>=$SINCE" -f per_page=100 \
--jq '.items[] | "- #\(.number) \(.title)"')
if [ -n "$CLOSED" ]; then
printf '\n## Closed issues\n\n%s\n' "$CLOSED" >> notes.md
fi
OPENED=$(gh api -X GET search/issues -f "q=repo:$REPO is:issue created:>=$SINCE is:open" -f per_page=100 \
--jq '.items[] | "- #\(.number) \(.title)"')
if [ -n "$OPENED" ]; then
printf '\n## Opened issues\n\n%s\n' "$OPENED" >> notes.md
fi
printf '\n**Full Changelog**: https://github.com/%s/compare/%s...%s\n' "$REPO" "$PREV_TAG" "$TAG" >> notes.md
fi
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${{ github.ref_name }}" \
"${{ steps.zip.outputs.path }}" \
--title "${{ github.ref_name }}" \
--notes-file notes.md
publish-changelog:
needs: release
permissions:
contents: write
uses: ./.github/workflows/changelogs.yml
with:
tag: ${{ github.ref_name }}