-
Notifications
You must be signed in to change notification settings - Fork 2
161 lines (138 loc) · 6.09 KB
/
release.yml
File metadata and controls
161 lines (138 loc) · 6.09 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
name: Release
on:
push:
tags:
- "v*"
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Extract short SHA
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Setup Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
targets: x86_64-unknown-linux-gnu,x86_64-pc-windows-gnu
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v4
with:
path: |
target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Cache Gradle Dependencies
id: cache-gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/gradle-wrapper.jar') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Install Protobuf Compiler and MinGW (for Windows build)
run: sudo apt update && sudo apt install protobuf-compiler gcc-mingw-w64 -y
- name: Create release branch and bump version
env:
TAG_NAME: ${{ github.ref_name }}
run: |
# Remove the 'v' prefix from the tag name
VERSION=${TAG_NAME#v}
BRANCH=release/${TAG_NAME}
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git checkout -b $BRANCH
git push -u origin $BRANCH
sed -i "s/project\\.version=0\\.0\\.0-nightly/project\\.version=${VERSION}/g" clients/java/gradle.properties
sed -i "s/version = \"0\\.0\\.0-nightly\"/version = \"${VERSION}\"/g" plugins/pelican/Cargo.toml
sed -i "s/version = \"0\\.0\\.0-nightly\"/version = \"${VERSION}\"/g" plugins/local/Cargo.toml
sed -i "s/version = \"0\\.0\\.0-nightly\"/version = \"${VERSION}\"/g" plugins/cloudflare/Cargo.toml
sed -i "s/version = \"0\\.0\\.0-nightly\"/version = \"${VERSION}\"/g" clients/wrapper/Cargo.toml
sed -i "s/version = \"0\\.0\\.0-nightly\"/version = \"${VERSION}\"/g" controller/Cargo.toml
sed -i "s/version = \"0\\.0\\.0-nightly\"/version = \"${VERSION}\"/g" common/Cargo.toml
sed -i "s/version = \"0\\.0\\.0-nightly\"/version = \"${VERSION}\"/g" cli/Cargo.toml
git add clients/java/gradle.properties plugins/pelican/Cargo.toml plugins/local/Cargo.toml plugins/cloudflare/Cargo.toml clients/wrapper/Cargo.toml controller/Cargo.toml common/Cargo.toml cli/Cargo.toml
git commit -m "ci(release): bump version"
git push
- name: Build Projects
run: |
rustup target add x86_64-pc-windows-gnu
cargo build --release --all --all-features --target x86_64-unknown-linux-gnu --target x86_64-pc-windows-gnu
env:
CURRENT_COMMIT: ${{ steps.vars.outputs.sha_short }}
CURRENT_BUILD: ${{ github.run_number }}
- name: Ensure Gradle Wrapper Permissions
working-directory: clients/java
run: chmod +x gradlew
- name: Build & Publish API
working-directory: clients/java
run: ./gradlew build publish --no-daemon
env:
CURRENT_COMMIT: ${{ steps.vars.outputs.sha_short }}
CURRENT_BUILD: ${{ github.run_number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Copy Compiled Files
run: |
cp ./target/x86_64-unknown-linux-gnu/release/controller controller-linux-x86_64
cp ./target/x86_64-pc-windows-gnu/release/controller.exe controller-windows-x86_64.exe
cp ./target/x86_64-unknown-linux-gnu/release/cli cli-linux-x86_64
cp ./target/x86_64-pc-windows-gnu/release/cli.exe cli-windows-x86_64.exe
cp ./target/x86_64-unknown-linux-gnu/release/wrapper wrapper-linux-x86_64
cp ./target/x86_64-pc-windows-gnu/release/wrapper.exe wrapper-windows-x86_64.exe
cp ./target/wasm32-wasip2/release/pelican.wasm pelican.wasm
cp ./target/wasm32-wasip2/release/local.wasm local.wasm
cp ./target/wasm32-wasip2/release/cloudflare.wasm cloudflare.wasm
cp $(find ./clients/java/paper/build -name "*-all.jar") ac-core.jar
cp $(find ./clients/java/paper/send/build -name "*-all.jar") ac-send.jar
cp $(find ./clients/java/paper/notify/build -name "*-all.jar") ac-notify.jar
cp $(find ./clients/java/paper/fake-proxy/build -name "*-all.jar") ac-fake-proxy.jar
- name: Create egg tar.gz and template tar.gz
run: |
tar -czvf templates.tar.gz -C templates .
tar -czvf eggs.tar.gz -C eggs .
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
files: |
controller-linux-x86_64
controller-windows-x86_64.exe
cli-linux-x86_64
cli-windows-x86_64.exe
wrapper-linux-x86_64
wrapper-windows-x86_64.exe
pelican.wasm
local.wasm
cloudflare.wasm
templates.tar.gz
eggs.tar.gz
ac-core.jar
ac-send.jar
ac-notify.jar
ac-fake-proxy.jar