-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (79 loc) · 3.01 KB
/
Copy pathvuru-release.yml
File metadata and controls
97 lines (79 loc) · 3.01 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
name: Vuru Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
pull-requests: write
jobs:
release-source:
runs-on: ubuntu-latest
steps:
- name: Generate App Token
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.VUP_BOT_APP_ID }}
private-key: ${{ secrets.VUP_BOT_PRIVATE_KEY }}
- name: Checkout Source
uses: actions/checkout@v7
with:
path: vup
fetch-depth: 0 # Needed for push
token: ${{ steps.app-token.outputs.token }}
- name: Create Source Tarball
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "Packaging Vuru version $VERSION"
# Prepare directory structure for tarball (vuru-1.0.0/)
mkdir -p dist/vuru-$VERSION
cp -r vup/vuru/* dist/vuru-$VERSION/
# Create deterministic tarball
# Ensures checksum remains constant across retries if source is unchanged
cd dist
tar --sort=name \
--mtime="2025-01-01 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--format=gnu \
-cf - vuru-$VERSION | gzip -n > vuru-$VERSION.tar.gz
- name: Release Source
uses: softprops/action-gh-release@v3
with:
files: dist/vuru-*.tar.gz
draft: false
prerelease: false
name: Vuru ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Template
run: |
VERSION=${GITHUB_REF_NAME#v}
CHECKSUM=$(sha256sum dist/vuru-$VERSION.tar.gz | cut -d ' ' -f 1)
echo "Updating template to version $VERSION with checksum $CHECKSUM"
# NOTE: 'vup' is the checkout directory, 'vup/srcpkgs' is inside the repo
TEMPLATE="vup/vup/srcpkgs/core/vuru/template"
sed -i "s/^version=.*/version=$VERSION/" "$TEMPLATE"
sed -i "s/^checksum=.*/checksum=\"$CHECKSUM\"/" "$TEMPLATE"
sed -i "s/^revision=.*/revision=1/" "$TEMPLATE"
# Verify change
cat "$TEMPLATE"
# Push changes to new branch
BRANCH="release/vuru-$VERSION"
cd vup
git config user.name "vup-bot[bot]"
git config user.email "vup-bot[bot]@users.noreply.github.com"
# Make workflow idempotent
git push origin --delete "$BRANCH" || true
git checkout -b "$BRANCH"
git add vup/srcpkgs/core/vuru/template
git commit -m "auto: update vuru to $VERSION"
git push -u origin "$BRANCH"
# Create Pull Request
gh pr create \
--title "auto: update vuru to $VERSION" \
--body "Automated update containing checksum changes for vuru v$VERSION." \
--head "$BRANCH" \
--base main
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}