-
-
Notifications
You must be signed in to change notification settings - Fork 150
141 lines (134 loc) · 5.2 KB
/
release.yaml
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
on:
release:
types: [published]
name: Release
jobs:
release:
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
- os: ubuntu-latest
goos: windows
- os: macos-latest
goos: darwin
env:
GOOS: ${{ matrix.goos }}
CGO_ENABLED: 0
name: release
runs-on: ${{ matrix.os }}
outputs:
sha_linux: ${{ steps.shasum.outputs.sha_linux }}
steps:
- uses: actions/checkout@v4
- name: Use Go 1.22.x
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Test
if: ${{ matrix.goos != 'windows' }}
run: go test
env:
GOOS: ${{ matrix.goos }}
- name: Build ${{ matrix.goos }} amd64
if: ${{ matrix.goos != 'darwin' }}
run: go build -o mob${{ matrix.goos == 'windows' && '.exe' || '' }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: amd64
- name: Build macOS universal
if: ${{ matrix.goos == 'darwin' }}
run: >
GOARCH=amd64 go build -o mob_amd64 && GOARCH=arm64 go build -o mob_arm64 && lipo -create -output mob mob_amd64 mob_arm64
env:
GOOS: ${{ matrix.goos }}
- name: VirusTotal Scan
uses: crazy-max/ghaction-virustotal@v3
with:
vt_api_key: ${{ secrets.VT_API_KEY }}
update_release_body: true
files: ./mob${{ matrix.goos == 'windows' && '.exe' || '' }}
- name: Create release artifacts using .github/build
run: .github/build
env:
GOARCH: amd64
VERSION: ${{ github.event.release.tag_name }}
- name: Upload artifacts to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "*{.tar.gz,_checksum.txt}"
tag: ${{ github.event.release.tag_name }}
file_glob: true
- name: Set SHA
if: matrix.goos == 'darwin' || matrix.goos == 'linux'
id: shasum
run: |
echo "sha_${{ matrix.goos }}=\"$(shasum -a 256 *.tar.gz | awk '{printf $1}')\"" >> $GITHUB_OUTPUT
- name: Set up Homebrew
if: matrix.goos == 'darwin'
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Bump homebrew formula
if: matrix.goos == 'darwin'
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "CI"
brew tap ${{github.repository_owner}}/homebrew-brew
brew bump-formula-pr -f --version=${{ github.event.release.tag_name }} --no-browse --no-audit \
--sha256=${{ steps.shasum.outputs.sha_darwin }} \
--url="https://github.com/${{github.repository_owner}}/mob/releases/download/${{ github.event.release.tag_name }}/mob_${{ github.event.release.tag_name }}_darwin_universal.tar.gz" \
${{github.repository_owner}}/homebrew-brew/mob
publish-arch-linux-package:
needs: [release]
name: Publish Arch Linux package
runs-on: ubuntu-latest
env:
PACKAGE_NAME: mobsh-bin
steps:
- name: Create PKGBUILD
run: |
# Create the output directory
mkdir -p ./aur/${{ env.PACKAGE_NAME }}/
# Strip the leading "v" from the version
PACKAGE_VERSION="$(echo "${{ github.event.release.tag_name }}" | sed -e 's/^v//')"
# Output PKGBUILD
cat > ./aur/${{ env.PACKAGE_NAME }}/PKGBUILD << EOF
# Where to file issues: https://github.com/${{ github.repository }}/issues
pkgname=${{ env.PACKAGE_NAME }}
pkgver=$PACKAGE_VERSION
pkgrel=1
pkgdesc="Fast git handover with mob"
arch=('x86_64')
url="https://github.com/${{ github.repository }}"
license=('MIT')
depends=("git")
optdepends=('espeak-ng-espeak: Multi-lingual software speech synthesizer'
'mbrola-voices-us1: An American English female voice for the MBROLA synthesizer')
provides=('mobsh')
conflicts=('mobsh' 'mob')
source_x86_64=("\$url/releases/download/${{ github.event.release.tag_name }}/mob_${{ github.event.release.tag_name }}_linux_amd64.tar.gz")
sha256sums_x86_64=("${{ needs.release.outputs.sha_linux }}")
package() {
install -D -m644 "LICENSE" "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE"
install -D -m755 "mob" "\$pkgdir/usr/bin/mob"
}
EOF
- name: Store PKGBUILD as an artifact
uses: actions/upload-artifact@v4
with:
name: PKGBUILD
path: ./aur/${{ env.PACKAGE_NAME }}/PKGBUILD
- name: Publish AUR package
uses: KSXGitHub/[email protected]
with:
pkgname: ${{ env.PACKAGE_NAME }}
pkgbuild: ./aur/${{ env.PACKAGE_NAME }}/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Update AUR package for ${{ github.event.release.tag_name }}
ssh_keyscan_types: rsa,ecdsa,ed25519