forked from WindSpiritSR/CustomCACert
-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (51 loc) · 1.91 KB
/
Copy pathrelease.yml
File metadata and controls
58 lines (51 loc) · 1.91 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
name: Release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get tag
id: tag
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: Update update.json and module.prop
env:
VERSION: ${{ steps.tag.outputs.VERSION }}
REPO: ${{ github.repository }}
run: |
NEW_CODE=$(( $(jq -r '.versionCode' update.json) + 1 ))
jq --arg v "$VERSION" \
--argjson c "$NEW_CODE" \
--arg z "https://github.com/${REPO}/releases/download/${VERSION}/CustomCACert-${VERSION}.zip" \
--arg cl "https://github.com/${REPO}/releases/tag/${VERSION}" \
'.version=$v | .versionCode=$c | .zipUrl=$z | .changelog=$cl' \
update.json > tmp.json && mv tmp.json update.json
sed -i "s/^version=.*/version=${VERSION}/" module.prop
sed -i "s/^versionCode=.*/versionCode=${NEW_CODE}/" module.prop
- name: Commit update.json and module.prop
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add update.json module.prop
git diff --cached --quiet || git commit -m "Update update.json and module.prop for ${{ steps.tag.outputs.VERSION }}"
git push origin HEAD:main
- name: Build zip
run: |
zip -r "CustomCACert-${{ steps.tag.outputs.VERSION }}.zip" \
META-INF \
module.prop \
post-fs-data.sh \
system \
LICENSE \
update.json
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: CustomCACert-${{ steps.tag.outputs.VERSION }}.zip
generate_release_notes: true