Skip to content

Commit fe3d3df

Browse files
committed
ci: upload offline tarball
1 parent 2f90b73 commit fe3d3df

File tree

6 files changed

+94
-28
lines changed

6 files changed

+94
-28
lines changed

.github/workflows/build.yaml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ jobs:
4444
with:
4545
version: 9
4646
- name: Prepare workspace
47-
run: rm -rf source && mkdir source
47+
run: rm -rf source && mkdir -p source/artifacts
48+
4849
- name: Checkout GlobalProtect-openconnect
4950
uses: actions/checkout@v4
5051
with:
5152
token: ${{ secrets.GH_PAT }}
5253
repository: yuezk/GlobalProtect-openconnect
5354
ref: ${{ github.ref }}
5455
path: source/gp
56+
5557
- name: Create tarball
5658
run: |
5759
cd source/gp
@@ -60,13 +62,69 @@ jobs:
6062
touch SNAPSHOT
6163
fi
6264
make tarball
65+
66+
mv -v .build/tarball/*.tar.gz ../artifacts/
67+
68+
- name: Generate RPM spec file
69+
env:
70+
RELEASE_TAG: ${{ github.ref == 'refs/heads/dev' && 'snapshot' || github.ref_name }}
71+
run: |
72+
cd source/gp
73+
74+
make init-rpm \
75+
REVISION='1%{?dist}' \
76+
RPM_SOURCE=https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${RELEASE_TAG}/%{name}-%{version}.tar.gz
77+
78+
mv -v .build/rpm/*.spec ../artifacts/
79+
6380
- name: Upload tarball
6481
uses: actions/upload-artifact@v4
6582
with:
6683
name: artifact-source
6784
if-no-files-found: error
6885
path: |
69-
source/gp/.build/tarball/*.tar.gz
86+
source/artifacts/*
87+
88+
tarball-offline:
89+
if: ${{ github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/') }}
90+
runs-on: ubuntu-latest
91+
needs:
92+
- tarball
93+
steps:
94+
- uses: pnpm/action-setup@v4
95+
with:
96+
version: 9
97+
98+
- name: Prepare workspace
99+
run: rm -rf source-offline && mkdir source-offline
100+
101+
- name: Download tarball
102+
uses: actions/download-artifact@v4
103+
with:
104+
name: artifact-source
105+
path: source-offline
106+
107+
- name: Create offline tarball
108+
run: |
109+
cd source-offline
110+
111+
offline_tarball=$(basename *.tar.gz .tar.gz).offline.tar.gz
112+
113+
# Extract the tarball
114+
tar -xzf *.tar.gz
115+
116+
cd */
117+
make tarball OFFLINE=1
118+
119+
# Rename the tarball to .offline.tar.gz
120+
mv -v .build/tarball/*.tar.gz ../$offline_tarball
121+
122+
- name: Upload offline tarball
123+
uses: actions/upload-artifact@v4
124+
with:
125+
path: source-offline/*.offline.tar.gz
126+
name: artifact-source-offline
127+
if-no-files-found: error
70128

71129
build-gp:
72130
needs:
@@ -168,6 +226,7 @@ jobs:
168226
runs-on: ubuntu-latest
169227
needs:
170228
- tarball
229+
- tarball-offline
171230
- build-gp
172231
- build-gpgui
173232

.github/workflows/publish.yaml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,26 @@ jobs:
5252
version: 9
5353
- name: Prepare workspace
5454
run: rm -rf publish-ppa && mkdir publish-ppa
55-
- name: Download ${{ inputs.tag }} source code
56-
uses: robinraju/release-downloader@v1.9
57-
with:
58-
token: ${{ secrets.GH_PAT }}
59-
tag: ${{ inputs.tag }}
60-
fileName: globalprotect-openconnect-*.tar.gz
61-
tarBall: false
62-
zipBall: false
63-
out-file-path: publish-ppa
64-
- name: Make the offline tarball
55+
- name: Download ${{ inputs.tag }} offline source code
56+
env:
57+
GH_TOKEN: ${{ secrets.GH_PAT }}
58+
run: |
59+
gh -R yuezk/GlobalProtect-openconnect \
60+
release download ${{ inputs.tag }} \
61+
--pattern '*.offline.tar.gz' \
62+
--dir publish-ppa
63+
- name: Patch the source code
6564
run: |
6665
cd publish-ppa
67-
tar -xf globalprotect-openconnect-*.tar.gz
68-
cd globalprotect-openconnect-*/
6966
70-
make tarball OFFLINE=1
67+
# Rename the source tarball without the offline suffix
68+
mv -v *.tar.gz $(basename *.tar.gz .offline.tar.gz).tar.gz
69+
70+
# Extract the source tarball
71+
tar -xzf *.tar.gz
72+
73+
# Prepare the debian directory with custom files
74+
cd globalprotect-openconnect-*/
7175
7276
# Prepare the debian directory with custom files
7377
mkdir -p .build/debian
@@ -78,7 +82,6 @@ jobs:
7882
cp -v packaging/deb/postrm .build/debian/postrm
7983
8084
sed -i "s/@RUST@/cargo-1.80/g" .build/debian/control
81-
8285
sed -i "s/@OFFLINE@/1/g" .build/debian/rules
8386
sed -i "s/@BUILD_GUI@/1/g" .build/debian/rules
8487
sed -i "s/@RUST_VERSION@/1.80/g" .build/debian/rules
@@ -89,7 +92,7 @@ jobs:
8992
repository: "yuezk/globalprotect-openconnect"
9093
gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }}
9194
gpg_passphrase: ${{ secrets.PPA_GPG_PASSPHRASE }}
92-
tarball: publish-ppa/globalprotect-openconnect-*/.build/tarball/*.tar.gz
95+
tarball: publish-ppa/globalprotect-openconnect-*.tar.gz
9396
debian_dir: publish-ppa/globalprotect-openconnect-*/.build/debian
9497
deb_email: "k3vinyue@gmail.com"
9598
deb_fullname: "Kevin Yue"

.github/workflows/release.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,16 @@ jobs:
9696
steps:
9797
- name: Prepare workspace
9898
run: rm -rf build-${{ matrix.package }} && mkdir -p build-${{ matrix.package }}
99+
99100
- name: Download ${{ inputs.tag }} source code
100-
uses: robinraju/release-downloader@v1.9
101-
with:
102-
token: ${{ secrets.GH_PAT }}
103-
tag: ${{ inputs.tag }}
104-
fileName: globalprotect-openconnect-*.tar.gz
105-
tarBall: false
106-
zipBall: false
107-
out-file-path: build-${{ matrix.package }}
101+
env:
102+
GH_TOKEN: ${{ secrets.GH_PAT }}
103+
run: |
104+
gh -R yuezk/GlobalProtect-openconnect \
105+
release download ${{ inputs.tag }} \
106+
--pattern '*[^offline].tar.gz' \
107+
--dir build-${{ matrix.package }}
108+
108109
- name: Docker Login
109110
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
110111
- name: Build ${{ matrix.package }} package in Docker

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ RUST_VERSION = 1.80
88

99
VERSION = $(shell $(CARGO) metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
1010
REVISION ?= 1
11+
RPM_SOURCE ?= %{name}.tar.gz
12+
1113
PPA_REVISION ?= 1
1214
PKG_NAME = globalprotect-openconnect
1315
PKG = $(PKG_NAME)-$(VERSION)
@@ -234,6 +236,7 @@ init-rpm: clean-rpm
234236

235237
sed -i "s/@VERSION@/$(VERSION)/g" .build/rpm/globalprotect-openconnect.spec
236238
sed -i "s/@REVISION@/$(REVISION)/g" .build/rpm/globalprotect-openconnect.spec
239+
sed -i "s|@SOURCE@|$(RPM_SOURCE)|g" .build/rpm/globalprotect-openconnect.spec
237240
sed -i "s/@OFFLINE@/$(OFFLINE)/g" .build/rpm/globalprotect-openconnect.spec
238241
sed -i "s/@DATE@/$(shell LC_ALL=en.US date "+%a %b %d %Y")/g" .build/rpm/globalprotect-openconnect.spec
239242

packaging/rpm/globalprotect-openconnect.spec.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Group: Productivity/Networking/PPP
66

77
License: GPL-3.0
88
URL: https://github.com/yuezk/GlobalProtect-openconnect
9-
Source: %{name}.tar.gz
9+
Source: @SOURCE@
1010

1111
BuildRequires: make
1212
BuildRequires: rust

scripts/gh-release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ release_snapshot() {
2828

2929
echo "Uploading new assets..."
3030
gh -R "$REPO" release upload "$TAG" \
31-
"$PROJECT_DIR"/.build/artifacts/artifact-source/* \
31+
"$PROJECT_DIR"/.build/artifacts/artifact-source*/* \
3232
"$PROJECT_DIR"/.build/artifacts/artifact-gpgui-*/*
3333
}
3434

@@ -40,7 +40,7 @@ release_tag() {
4040
gh -R "$REPO" release create $TAG \
4141
--title "$TAG" \
4242
--notes "$RELEASE_NOTES" \
43-
"$PROJECT_DIR"/.build/artifacts/artifact-source/* \
43+
"$PROJECT_DIR"/.build/artifacts/artifact-source*/* \
4444
"$PROJECT_DIR"/.build/artifacts/artifact-gpgui-*/*
4545
}
4646

0 commit comments

Comments
 (0)