1
0
mirror of https://github.com/coalaura/ffwebp.git synced 2025-07-17 22:04:35 +00:00

improve ci

This commit is contained in:
Laura
2025-06-19 16:20:19 +02:00
parent d0fae21d6c
commit 6ddf02ff19

View File

@ -14,49 +14,62 @@ jobs:
strategy:
matrix:
goos: [windows, linux, darwin]
goos: [windows, linux, darwin]
goarch: [amd64, arm64]
flavour: [core, full]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.1'
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.1'
- name: Set up Environment
run: |
mkdir -p build
- name: Build ${{ matrix.goos }}_${{ matrix.goarch }} (${{
matrix.flavour }})
shell: bash
run: |
mkdir -p build
[[ "${{ matrix.goos }}" == "windows" ]] && EXT=".exe" || EXT=""
- name: Build for ${{ matrix.goos }}_${{ matrix.goarch }}
run: |
if [ "${{ matrix.goos }}" = "windows" ]; then EXT=".exe"; else EXT=""; fi
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-s -w -X 'main.Version=${{ github.ref_name }}'" -trimpath -o build/ffwebp_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }}$EXT
OUT="build/ffwebp_${{ github.ref_name }}_${{ matrix.flavour }}_${{ matrix.goos }}_${{ matrix.goarch }}${EXT}"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ffwebp_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }}
path: ./build/ffwebp_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }}*
GOOS=${{ matrix.goos }} \
GOARCH=${{ matrix.goarch }} \
CGO_ENABLED=0 \
go build \
-trimpath \
-buildvcs=false \
-buildid= \
-ldflags "-s -w -X 'main.Version=${{ github.ref_name }}'" \
-tags "${{ matrix.flavour }}" \
-o "$OUT"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ffwebp_${{ github.ref_name }}_${{ matrix.flavour }}_${{ matrix.goos }}_${{ matrix.goarch }}
path: build/*
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./build
- 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 }}
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: ./build/**
name: "Release ${{ github.ref_name }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}