-
-
Notifications
You must be signed in to change notification settings - Fork 10
89 lines (76 loc) · 3 KB
/
release-linux.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
name: Release October (Linux)
on:
release:
types: [published]
jobs:
release:
name: Release October (Linux)
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Normalise platform tag
id: normalise_platform
shell: bash
run: |
tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g')
echo "::set-output name=tag::$tag"
- name: Normalise version tag
id: normalise_version
shell: bash
run: |
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g')
echo "::set-output name=version::$version"
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Install wails
shell: bash
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Install Ubuntu prerequisites
shell: bash
run: sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: '20.8.0'
- name: Build frontend assets
shell: bash
run: |
npm install -g npm
node version.js ${{ github.event.release.tag_name }}
cd frontend && npm install
- name: Build wails app for Linux
shell: bash
run: CGO_ENABLED=1 wails build -platform ${{ matrix.platform }} -ldflags "-X main.version=${{ github.event.release.tag_name }}"
- name: Package up deb file
shell: bash
run: |
mv build/bin/october build/linux/october_0.0.0_amd64/usr/local/bin/
cd build/linux
mv october_0.0.0_amd64 "october_${{ steps.normalise_version.outputs.version }}_amd64"
sed -i 's/0.0.0/${{ steps.normalise_version.outputs.version }}/g' "october_${{ steps.normalise_version.outputs.version }}_amd64/DEBIAN/control"
dpkg-deb --build "october_${{ steps.normalise_version.outputs.version }}_amd64"
- name: Get latest release from API
id: get_upload_url
shell: bash
run: |
curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/marcus-crane/october/releases" > /tmp/releases.json
url=$(jq -r '.[0].upload_url' /tmp/releases.json)
echo "::set-output name=url::$url"
- name: Upload artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACT_NAME: october_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}
with:
upload_url: ${{ steps.get_upload_url.outputs.url }}
asset_path: ./build/linux/october_${{ steps.normalise_version.outputs.version }}_amd64.deb
asset_name: ${{ env.ARTIFACT_NAME }}.deb
asset_content_type: application/octet-stream