62 lines
1.7 KiB
YAML
62 lines
1.7 KiB
YAML
name: Build & Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
goos: [linux, windows]
|
|
goarch: [amd64, arm]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.22.x'
|
|
|
|
- name: Build binary
|
|
run: |
|
|
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/app-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }} main.go
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: app-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
path: dist/app-*
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: ./dist
|
|
|
|
- name: Flatten all artifacts into ./dist
|
|
run: |
|
|
find ./dist -type f -name 'app-*' -exec mv {} ./dist/ \;
|
|
|
|
- name: Create Release & Attach Files
|
|
uses: rosven9856/gitea_creating_release_action@master
|
|
with:
|
|
gitea_schema: 'https'
|
|
gitea_host: 'git.ztsw.de'
|
|
gitea_organization: 'pedan'
|
|
gitea_repo: 'go-fileserver'
|
|
access_token: ${{ secrets.GITEA_TOKEN }}
|
|
release_body: 'Auto-build release'
|
|
release_draft: 'false'
|
|
release_name: ${{ github.ref_name }}
|
|
release_prerelease: 'false'
|
|
release_tag_name: ${{ github.ref_name }}
|
|
release_target_commitish: ${{ github.sha }}
|
|
release_assets: './dist/app-*'
|