-
Notifications
You must be signed in to change notification settings - Fork 1
178 lines (145 loc) · 4.87 KB
/
Copy pathrelease.yml
File metadata and controls
178 lines (145 loc) · 4.87 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Release
on:
push:
tags: [ 'v*' ]
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
outputs:
full-version: ${{ steps.version.outputs.full-version }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Extract version from tag
run: |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV"
- name: Build and package
run: ./gradlew :core:distZip :core:distTar
- name: Export full version
id: version
run: echo "full-version=$(grep '^version=' build/generated/version/version.properties | cut -d= -f2)" >> "$GITHUB_OUTPUT"
- name: Install build dependencies
run: sudo apt-get update -y && sudo apt-get install -y libcjson-dev
- name: Build .deb package
run: ./gradlew buildDeb
- name: Publish api to GitHub Packages
run: ./gradlew :api:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
run: |
gh release create "v$VERSION" \
--title "AutoTweaker v$VERSION" \
--generate-notes \
core/build/distributions/*.zip \
core/build/distributions/*.tar \
.temp/deb/*.deb
env:
GH_TOKEN: ${{ github.token }}
update-index:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Extract version from tag
run: |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV"
- name: Install PyYAML
run: pip3 install pyyaml
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.WEBSITE_DEPLOY_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -t ed25519 github.com >> ~/.ssh/known_hosts
- name: Clone index repository
run: git clone git@github.com:AutoTweaker/index.git .temp/index
env:
GIT_SSH_COMMAND: ssh -i ~/.ssh/deploy_key
- name: Configure git
working-directory: .temp/index
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Merge release assets into index
working-directory: .temp/index
run: |
gh release view "v${VERSION}" --repo AutoTweaker/core --json assets \
| python3 ../../scripts/merge-index.py ../../index.yml index.json "${{ needs.release.outputs.full-version }}"
env:
GH_TOKEN: ${{ github.token }}
- name: Push index update
working-directory: .temp/index
run: |
git add index.json
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Update core to v${VERSION}"
git push origin main
fi
env:
GIT_SSH_COMMAND: ssh -i ~/.ssh/deploy_key
deploy-docs:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Extract version from tag
run: |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV"
- name: Generate Dokka docs
run: ./gradlew :api:dokkaGenerate
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.PAGES_DEPLOY_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -t ed25519 github.com >> ~/.ssh/known_hosts
- name: Clone pages repository
run: git clone git@github.com:AutoTweaker/autotweaker.github.io.git .temp/pages
env:
GIT_SSH_COMMAND: ssh -i ~/.ssh/deploy_key
- name: Configure git
working-directory: .temp/pages
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Deploy docs
working-directory: .temp/pages
run: |
rm -rf doc
mkdir doc
cp -r ../../api/build/dokka/api/* doc/
- name: Push
working-directory: .temp/pages
run: |
git add doc
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Update API docs for v${VERSION}"
git push origin main
fi
env:
GIT_SSH_COMMAND: ssh -i ~/.ssh/deploy_key