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