-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (116 loc) · 3.82 KB
/
Copy pathrelease.yml
File metadata and controls
135 lines (116 loc) · 3.82 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
strategy:
matrix:
include:
- { arch: aarch64, os: macos }
- { arch: x86_64, os: macos }
- { arch: aarch64, os: linux }
- { arch: x86_64, os: linux, abi: gnu }
- { arch: x86_64, os: linux, abi: musl }
- { arch: x86_64, os: windows }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.15.2
- name: Build
run: |
zig build -Dcross=true -Doptimize=ReleaseSafe
- name: Package artifacts
run: |
TARGET="${{ matrix.arch }}-${{ matrix.os }}${{ matrix.abi && format('-{0}', matrix.abi) || '' }}"
BINARY="shgit${{ matrix.os == 'windows' && '.exe' || '' }}"
cd zig-out/$TARGET
if [ "${{ matrix.os }}" = "windows" ]; then
zip -r ../../shgit-$TARGET.zip shgit.exe shgit.pdb
else
tar -czf ../../shgit-$TARGET.tar.gz shgit
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: shgit-${{ matrix.arch }}-${{ matrix.os }}${{ matrix.abi && format('-{0}', matrix.abi) || '' }}
path: shgit-${{ matrix.arch }}-${{ matrix.os }}${{ matrix.abi && format('-{0}', matrix.abi) || '' }}.*
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v1
with:
files: artifacts/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-aur:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Download x86_64 Linux artifact
uses: actions/download-artifact@v4
with:
name: shgit-x86_64-linux-gnu
path: artifact
- name: Calculate SHA256
id: sha256
run: |
SHA256=$(sha256sum artifact/shgit-x86_64-linux-gnu.tar.gz | cut -d' ' -f1)
echo "SHA256=$SHA256" >> $GITHUB_OUTPUT
- name: Generate PKGBUILD
run: |
cat > PKGBUILD << 'EOF'
# Maintainer: 0_byte <git@susnext.com>
pkgname=shgit-bin
pkgver=${{ steps.version.outputs.VERSION }}
pkgrel=1
pkgdesc="A shell-based git client"
arch=('x86_64')
url="https://github.com/0byte-coding/shgit"
license=('MIT')
provides=('shgit')
conflicts=('shgit')
depends=('git')
source=("${pkgname}-${pkgver}.tar.gz::${url}/releases/download/v${pkgver}/shgit-x86_64-linux-gnu.tar.gz")
sha256sums=('${{ steps.sha256.outputs.SHA256 }}')
package() {
install -Dm755 "$srcdir/shgit" "$pkgdir/usr/bin/shgit"
}
EOF
- name: Generate .SRCINFO
run: |
docker run --rm -v "$PWD:/pkg" -w /pkg archlinux:latest bash -c "
pacman -Sy --noconfirm binutils fakeroot
useradd -m builder
chown -R builder:builder /pkg
su builder -c 'makepkg --printsrcinfo > .SRCINFO'
"
- name: Publish to AUR
uses: KSXGitHub/github-actions-deploy-aur@v2.7.2
with:
pkgname: shgit-bin
pkgbuild: ./PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: "Update to version ${{ steps.version.outputs.VERSION }}"
ssh_keyscan_types: rsa,ecdsa,ed25519