From 44ba51184b1f27b589e664077f543ffa982c9322 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sun, 30 Jun 2024 14:56:17 +0900 Subject: [PATCH] workflows: add release workflow --- .gitea/workflows/release.yml | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..f67b425 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,54 @@ +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' -o bin/rpcfetch-linux ./fetch && + 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 -H=windowsgui' -o bin/rpcfetch.exe ./fetch && + 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}}'