-
Notifications
You must be signed in to change notification settings - Fork 4
120 lines (97 loc) · 3.43 KB
/
publish.yml
File metadata and controls
120 lines (97 loc) · 3.43 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
name: Publish
# Controls when the workflow will run
on:
push:
branches:
- 'master'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
submodules: 'recursive'
- name: Determine next tag
id: get_tag
run: |
git fetch --tags
# Get the latest tag in the format r-N
latest_tag=$(git tag | grep -E '^r-[0-9]+$' | sort -V | tail -n 1)
# Extract the numeric part N from r-N
if [[ $latest_tag =~ ^r-([0-9]+)$ ]]; then
latest_number=${BASH_REMATCH[1]}
else
latest_number=0
fi
new_number=$((latest_number + 1))
new_tag="r-${new_number}"
echo "Latest tag: $latest_tag"
echo "New tag: $new_tag"
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
- name: Download bob
uses: robinraju/release-downloader@v1
with:
repository: 'swz-git/bob'
latest: true
fileName: 'bob_*_x86_64-unknown-linux-musl.zip'
extract: true
- run: chmod +x bob
# re-assemble bob_build directory from the latest release
- uses: robinraju/release-downloader@v1
id: download_packs
continue-on-error: true
with:
latest: true
fileName: '*.tar.xz'
- uses: robinraju/release-downloader@v1
continue-on-error: true
with:
latest: true
fileName: 'buildinfo.toml'
- uses: robinraju/release-downloader@v1
id: should_rebuild
continue-on-error: true
with:
latest: true
fileName: 'should_rebuild'
- name: Extract archives
if: ${{ steps.download_packs.outcome == 'success' }}
run: |
mkdir -p bob_build
for file in *.tar.xz; do tar --transform 's|^[^/]*|bob_build|' -xf "$file"; done
mv buildinfo.toml bob_build/
- name: Copy old botpack
if: ${{ steps.download_packs.outcome == 'success' }}
run: cp -r bob_build bob_build_old
- name: Split old platforms
if: ${{ steps.download_packs.outcome == 'success' }}
run: ./bob split bob_build_old
- name: Force rebuild by deleting buildinfo
if: ${{ steps.should_rebuild.outcome == 'success' }}
run: find . -name 'buildinfo.toml' -delete
- name: Build
run: ./bob build bob.toml
- name: Split new platforms
run: ./bob split bob_build
- name: Compress full botpack
run: |
tar cf - bob_build_x86_64-windows | xz -9 > botpack_x86_64-windows.tar.xz
tar cf - bob_build_x86_64-linux | xz -9 > botpack_x86_64-linux.tar.xz
- name: Generate platform diffs
if: ${{ steps.download_packs.outcome == 'success' }}
run: |
./bob diff bob_build_old_x86_64-windows bob_build_x86_64-windows > patch_x86_64-windows.bobdiff
./bob diff bob_build_old_x86_64-linux bob_build_x86_64-linux > patch_x86_64-linux.bobdiff
- name: Publish to GitHub Releases
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_tag.outputs.new_tag }}
files: |
botpack_*.tar.xz
patch_*.bobdiff
bob_build/buildinfo.toml
body: 'Pre-built binaries of various bots'