61 lines
1.7 KiB
YAML
61 lines
1.7 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- v*
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
contents: write
|
|
pull-requests: read
|
|
checks: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23'
|
|
- uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: v1.60
|
|
- name: Build
|
|
run: make -j8 all && tree dist
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: |
|
|
dist/**/*.zip
|
|
dist/**/*.tar.gz
|
|
dist/**/*.sha256sum
|
|
- name: Upload Release Asset
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
gh release create ${GIT_TAG} $(find dist/ -name "*.zip*" -o -name "*.tar.gz*")
|
|
env:
|
|
GIT_TAG: ${{ github.ref_name }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: docker/setup-buildx-action@v3
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64,linux/arm64,linux/riscv64,linux/386
|
|
push: true
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:${{ startsWith(github.ref, 'refs/tags/') && 'latest' || 'dev' }}
|
|
ghcr.io/${{ github.repository }}:${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || github.sha }} |