Skip to content

Commit 6b5ddb4

Browse files
committed
adding arch workflow
1 parent 258268c commit 6b5ddb4

File tree

1 file changed

+50
-7
lines changed

1 file changed

+50
-7
lines changed

.github/workflows/build.yml

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
paths:
8+
- 'app/**' # Only trigger if files in the app folder change
79

810
jobs:
911
build:
@@ -12,7 +14,7 @@ jobs:
1214
strategy:
1315
fail-fast: false
1416
matrix:
15-
os: [ubuntu-latest, windows-latest, macos-latest]
17+
os: [ubuntu-latest, windows-latest, macos-latest, archlinux-latest]
1618
include:
1719
- os: ubuntu-latest
1820
target: x86_64-unknown-linux-gnu
@@ -23,6 +25,9 @@ jobs:
2325
- os: macos-latest
2426
target: aarch64-apple-darwin
2527
package_type: mac
28+
- os: archlinux-latest
29+
target: x86_64-unknown-linux-gnu
30+
package_type: archzst
2631

2732
steps:
2833
- name: Checkout code
@@ -46,17 +51,23 @@ jobs:
4651
restore-keys: |
4752
${{ runner.os }}-cargo-
4853
49-
- name: Install dependencies (Linux)
54+
- name: Install dependencies (Linux - Ubuntu)
5055
if: matrix.os == 'ubuntu-latest'
5156
run: |
5257
sudo apt-get update
5358
sudo apt-get install -y dpkg-dev libssl-dev pkg-config
5459
60+
- name: Install dependencies (Linux - Arch)
61+
if: matrix.os == 'archlinux-latest'
62+
run: |
63+
sudo pacman -Syu --noconfirm
64+
sudo pacman -S --needed --noconfirm base-devel openssl pkg-config zstd
65+
5566
- name: Install dependencies (macOS)
5667
if: matrix.os == 'macos-latest'
5768
run: |
5869
brew update
59-
brew install openssl@3 rustup-init pkg-config llvm
70+
brew install openssl@3 rustup-init pkg-config llvm zstd
6071
echo "OPENSSL_DIR=$(brew --prefix openssl@3)" >> $GITHUB_ENV
6172
echo "OPENSSL_LIB_DIR=$(brew --prefix openssl@3)/lib" >> $GITHUB_ENV
6273
echo "OPENSSL_INCLUDE_DIR=$(brew --prefix openssl@3)/include" >> $GITHUB_ENV
@@ -69,6 +80,7 @@ jobs:
6980
run: |
7081
choco install wixtoolset -y
7182
choco install openssl -y
83+
choco install zstd -y
7284
7385
7486
- name: Build Rust project (Windows/Linux)
@@ -87,8 +99,7 @@ jobs:
8799
OPENSSL_DIR: ${{ env.OPENSSL_DIR }}
88100
OPENSSL_LIB_DIR: ${{ env.OPENSSL_LIB_DIR }}
89101
OPENSSL_INCLUDE_DIR: ${{ env.OPENSSL_INCLUDE_DIR }}
90-
91-
102+
92103

93104
- name: Package Debian (.deb)
94105
if: matrix.package_type == 'deb'
@@ -101,6 +112,38 @@ jobs:
101112
env:
102113
DEB_BUILD_OPTIONS: nocheck
103114

115+
- name: Package Arch Linux (.tar.zst)
116+
if: matrix.package_type == 'archzst'
117+
run: |
118+
cargo install cargo-makepkg --force
119+
cd app
120+
# Create a basic PKGBUILD
121+
echo "pkgname='gitswift'" > PKGBUILD
122+
echo "pkgver=1.0" >> PKGBUILD
123+
echo "pkgrel=1" >> PKGBUILD
124+
echo "pkgdesc='A Git-Swift application'" >> PKGBUILD
125+
echo "arch=('any')" >> PKGBUILD
126+
echo "license=('MIT')" >> PKGBUILD
127+
echo "depends=()" >> PKGBUILD
128+
echo "makedepends=('rust')" >> PKGBUILD
129+
echo "source=(\"gitswift-$pkgver.tar.gz::$(pwd)/gitswift-$pkgver.tar.gz\")" >> PKGBUILD
130+
echo "sha256sums=('SKIP')" >> PKGBUILD
131+
echo "" >> PKGBUILD
132+
echo "package() {" >> PKGBUILD
133+
echo " install -Dm755 \"\$(pwd)/target/${{ matrix.target }}/release/gitswift\" \"\$pkgdir/usr/bin/gitswift\"" >> PKGBUILD
134+
echo "}" >> PKGBUILD
135+
136+
# Create a dummy tar.gz for makepkg
137+
mkdir -p gitswift-1.0
138+
cp target/${{ matrix.target }}/release/gitswift gitswift-1.0/
139+
tar -czvf gitswift-1.0.tar.gz gitswift-1.0
140+
141+
makepkg --nocheck --config "options=(!strip)" --compress zstd
142+
143+
mkdir -p artifacts
144+
mv *.zst artifacts/
145+
cd ..
146+
104147
- name: Package Windows (.exe/.msi)
105148
if: matrix.package_type == 'windows'
106149
run: |
@@ -119,7 +162,7 @@ jobs:
119162
mkdir -p ~/gitswift-installer/user/local/bin
120163
mkdir -p artifacts
121164
cp app/target/${{ matrix.target }}/release/gitswift ~/gitswift-installer/user/local/bin/
122-
pkgbuild --identifier com.singhropar.gitswift --version 1.0 --install-location / --root ~/gitswift-installer artifacts/gitswift.pkg
165+
pkgbuild --identifier com.singhropar.gitswift --version 1.0 --install-location / --root ~/gitswift-installer artifacts/gitswift.pkg
123166
env:
124167
BUNDLE_ID: com.singhropar.gitswift
125168
BUNDLE_NAME: gitswift
@@ -135,4 +178,4 @@ jobs:
135178
uses: actions/upload-artifact@v4
136179
with:
137180
name: packages-${{ matrix.os }}
138-
path: artifacts/*
181+
path: artifacts/*

0 commit comments

Comments
 (0)