fix: update release workflow

This commit is contained in:
Chang lue Tsen 2025-04-25 17:45:58 +09:00
parent 5f37d2727f
commit 79a599d265

View File

@ -1,5 +1,4 @@
name: Build and Publish Docker Image and Release name: Release
on: on:
push: push:
tags: tags:
@ -97,91 +96,26 @@ jobs:
releases-matrix: releases-matrix:
name: Release ppanel-server binary name: Release ppanel-server binary
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: release-notes needs: release-notes # wait for release-notes job to finish
strategy: strategy:
matrix: matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64,
# windows/386, windows/amd64, windows/arm64, darwin/amd64, darwin/arm64
goos: [ linux, windows, darwin ] goos: [ linux, windows, darwin ]
goarch: [ '386', amd64, arm64 ] goarch: [ '386', amd64, arm64 ]
exclude: exclude:
- goos: darwin - goarch: '386'
goarch: '386' goos: darwin
include:
- goos: linux
goarch: arm
goarm: 5
target: linux-armv5
- goos: linux
goarch: arm
goarm: 6
target: linux-armv6
- goos: linux
goarch: arm
goarm: 7
target: linux-armv7
- goos: windows
goarch: arm
goarm: 7
target: windows-armv7
- goos: linux
goarch: amd64
goamd64: v3
target: linux-amd64-v3
- goos: windows
goarch: amd64
goamd64: v3
target: windows-amd64-v3
- goos: darwin
goarch: amd64
goamd64: v3
target: darwin-amd64-v3
steps: steps:
- name: Checkout repository - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: wangyoucao577/go-release-action@v1
- name: Set up Go
uses: actions/setup-go@v5
with: with:
go-version: '1.21' github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
- name: Build binary with Makefile goarch: ${{ matrix.goarch }}
env: asset_name: "ppanel-server-${{ matrix.goos }}-${{ matrix.goarch }}"
GOOS: ${{ matrix.goos }} goversion: "https://dl.google.com/go/go1.23.3.linux-amd64.tar.gz"
GOARCH: ${{ matrix.goarch }} project_path: "."
GOARM: ${{ matrix.goarm }} binary_name: "ppanel-server"
GOMIPS: ${{ matrix.gomips }} extra_files: LICENSE etc
run: |
# Use default target for non-special architectures, otherwise use matrix.target
TARGET=${{ matrix.target != '' && matrix.target || format('{0}-{1}', matrix.goos, matrix.goarch) }}
make BINDIR=bin $TARGET
mv bin/ppanel-server-$TARGET* ppanel-server-$TARGET
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ppanel-server-${{ matrix.target != '' && matrix.target || format('{0}-{1}', matrix.goos, matrix.goarch) }}
asset_name: ppanel-server-${{ matrix.target != '' && matrix.target || format('{0}-{1}', matrix.goos, matrix.goarch) }}${{ matrix.goos == 'windows' && '.exe' || '' }}
asset_content_type: application/octet-stream
- name: Upload additional files
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: etc/ppanel.yaml
asset_name: ppanel.yaml
asset_content_type: text/yaml
- name: Upload LICENSE
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: LICENSE
asset_name: LICENSE
asset_content_type: text/plain