mirror of
https://github.com/coalaura/up.git
synced 2025-07-17 21:44:35 +00:00
ci build
This commit is contained in:
74
.github/workflows/release.yml
vendored
Normal file
74
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [windows, linux, darwin]
|
||||
goarch: [amd64, arm64]
|
||||
type: [client, server]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24.2'
|
||||
|
||||
- name: Build ${{ matrix.goos }}_${{ matrix.goarch }} (${{
|
||||
matrix.flavour }})
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p build
|
||||
[[ "${{ matrix.goos }}" == "windows" ]] && EXT=".exe" || EXT=""
|
||||
|
||||
OUT="build/up_${{ matrix.type }}_${{ github.ref_name }}_${{ matrix.flavour }}_${{ matrix.goos }}_${{ matrix.goarch }}${EXT}"
|
||||
|
||||
GOOS=${{ matrix.goos }} \
|
||||
GOARCH=${{ matrix.goarch }} \
|
||||
CGO_ENABLED=0 \
|
||||
go build \
|
||||
-trimpath \
|
||||
-buildvcs=false \
|
||||
-ldflags "-s -w -X 'main.Version=${{ github.ref_name }}'" \
|
||||
-tags "${{ matrix.flavour }}" \
|
||||
-o "$OUT" ./${{ matrix.type }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: up_${{ matrix.type }}_${{ github.ref_name }}_${{ matrix.flavour }}_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
path: build/*
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download all build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ./build
|
||||
|
||||
- name: Create GitHub release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: ./build/**
|
||||
name: "Release ${{ github.ref_name }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
Reference in New Issue
Block a user