Add write permissions to workflow #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- 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: 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: | | |
gh release upload "$tag" _build/${{matrix.platform}}_${{matrix.arch}}/zaparoo-${{matrix.platform}}_${{matrix.arch}}.zip |