-
-
Notifications
You must be signed in to change notification settings - Fork 17
107 lines (104 loc) · 3.81 KB
/
build.yml
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
name: Build all releases
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${tag}" \
--draft \
--generate-notes
build:
runs-on: ubuntu-latest
needs: create-release
strategy:
fail-fast: false
matrix:
platform:
- windows
- mac
- batocera
arch:
- amd64
- arm64
include:
- platform: steamos
arch: amd64
- platform: mister
arch: arm
- platform: mistex
arch: arm64
steps:
- uses: actions/checkout@v4
- id: zaparooapprel
uses: pozetroninc/[email protected]
with:
repository: ZaparooProject/zaparoo-app
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest Zaparoo App web build
run: |
APP_TAG=${{ steps.zaparooapprel.outputs.release }}
APP_VERSION=${APP_TAG#v}
APP_FILENAME=zaparoo_app-web-${APP_VERSION}.tar.gz
wget https://github.com/ZaparooProject/zaparoo-app/releases/download/${APP_TAG}/${APP_FILENAME} -O pkg/assets/_app/${APP_FILENAME}
mkdir pkg/assets/_app/dist
tar xf pkg/assets/_app/${APP_FILENAME} -C pkg/assets/_app/dist/
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Cache Go packages and build output
uses: actions/cache@v4
env:
cache-name: cache-go
with:
path: |
~/.cache/go-build
~/go
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{hashFiles('go.sum')}}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add QEMU for cross-compile support
run: docker run --privileged --rm tonistiigi/binfmt --install all
if: matrix.arch != 'amd64' && matrix.platform != 'windows' && matrix.platform != 'mac'
- name: Set up Docker CLI
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64,linux/arm
use: true
install: true
if: matrix.platform != 'windows' && matrix.platform != 'mac'
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
if: matrix.platform != 'windows' && matrix.platform != 'mac'
- name: Add cache override
run: echo CACHE_ARGS=\"--load --cache-to type=gha,mode=max,repository=${GITHUB_REPOSITORY},scope=${{matrix.platform}}-${{matrix.arch}} --cache-from type=gha,scope=${{matrix.platform}}-${{matrix.arch}}\" > .env
if: matrix.platform != 'windows' && matrix.platform != 'mac'
- name: Build
run: task build-${{matrix.platform}}-${{matrix.arch}}
- name: Add release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
mv _build/${{matrix.platform}}_${{matrix.arch}}/zaparoo-${{matrix.platform}}_${{matrix.arch}}.zip _build/${{matrix.platform}}_${{matrix.arch}}/zaparoo-${{matrix.platform}}_${{matrix.arch}}-${VERSION}.zip
gh release upload "$tag" _build/${{matrix.platform}}_${{matrix.arch}}/zaparoo-${{matrix.platform}}_${{matrix.arch}}-${VERSION}.zip