rpcfetch/.gitea/workflows/release.yml

55 lines
1.5 KiB
YAML
Raw Normal View History

2024-06-30 14:56:17 +09:00
name: release
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up go
uses: https://github.com/actions/setup-go@v5
with:
go-version: '>=1.20.1'
- name: Get dependencies
run: >-
sudo apt-get update &&
sudo apt-get install -y
bc
gcc
gcc-multilib
gcc-mingw-w64
pkg-config
libgl1-mesa-dev
libwayland-dev
libx11-dev
libxkbcommon-dev
xorg-dev
xvfb
if: ${{ runner.os == 'Linux' }}
- name: Build for Linux
run: >-
sh -c "go build -v -ldflags '-s -w -X main.Version=${{ github.ref_name }}' -o bin/rpcfetch-linux ./fetch &&
2024-06-30 14:56:17 +09:00
sha256sum --tag -b bin/rpcfetch-linux > bin/rpcfetch-linux.sha256"
- name: Build for Windows
run: >-
sh -c "CC=/usr/bin/x86_64-w64-mingw32-gcc
CGO_ENABLED=1
CGO_LDFLAGS='-static-libgcc -static'
GOOS=windows GOARCH=amd64
go build -v -ldflags '-s -w -X main.Version=${{ github.ref_name }} -H=windowsgui' -o bin/rpcfetch.exe ./fetch &&
2024-06-30 14:56:17 +09:00
sha256sum --tag -b bin/rpcfetch.exe > bin/rpcfetch.exe.sha256"
- name: Release
id: use-go-action
uses: https://gitea.com/actions/release-action@main
with:
files: |-
bin/**
api_key: '${{secrets.RELEASE_TOKEN}}'