-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (61 loc) · 2.13 KB
/
sync.yml
File metadata and controls
68 lines (61 loc) · 2.13 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
name: Sync release
on:
workflow_dispatch:
repository_dispatch:
types: [sync-release]
permissions:
id-token: write
contents: write
actions: write
attestations: write
env:
GH_TOKEN: ${{ github.token }}
SOURCE_REPO: 'ukriu/HyperUnlocked'
MODULE_NAME: 'HyperUnlocked'
jobs:
get_missing_tags:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.check.outputs.tags }}
latest: ${{ steps.check.outputs.latest }}
steps:
- name: Check tags
id: check
run: |
SOURCE_TAGS=$(gh api repos/$SOURCE_REPO/tags | jq -r '.[].name' | sort)
CURRENT_TAGS=$(gh api repos/$GITHUB_REPOSITORY/tags | jq -r '.[].name' | sort)
MISSING=$(comm -23 <(echo "$SOURCE_TAGS") <(echo "$CURRENT_TAGS"))
MISSING_JSON=$(echo "$MISSING" | jq -R -s -c 'split("\n")[:-1]')
echo "tags=$MISSING_JSON" >> $GITHUB_OUTPUT
LATEST=$(echo "$SOURCE_TAGS" | tail -1)
echo "latest=$LATEST" >> $GITHUB_OUTPUT
sync_and_release:
needs: get_missing_tags
if: needs.get_missing_tags.outputs.tags != '[]'
runs-on: ubuntu-latest
strategy:
matrix:
tag: ${{ fromJson(needs.get_missing_tags.outputs.tags) }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
token: ${{ secrets.REPO_SYNC_PAT }}
- name: Pull release artifact and notes
run: |
gh release download ${{ matrix.tag }} --repo $SOURCE_REPO --pattern "$MODULE_NAME.zip"
BODY=$(gh release view ${{ matrix.tag }} --repo $SOURCE_REPO --json body -q .body)
echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
echo "$BODY" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create Release
uses: KernelSU-Modules-Repo/module_release@main
with:
tag_name: ${{ matrix.tag }}
make_latest: ${{ matrix.tag == needs.get_missing_tags.outputs.latest }}
file: "${{ env.MODULE_NAME }}.zip"
body: ${{ env.RELEASE_BODY }}
generate_release_notes: false
- uses: actions/attest-build-provenance@v3
with:
subject-path: "${{ env.MODULE_NAME }}.zip"