sub-cli/.forgejo/workflows/ci.yml
CDN d185fa5355
All checks were successful
Build and Release / Build (darwin-amd64) (push) Successful in 22s
Build and Release / Build (linux-amd64) (push) Successful in 23s
Build and Release / Build (windows-amd64) (push) Successful in 18s
Build and Release / Build (darwin-arm64) (push) Successful in 20s
Build and Release / Build (linux-arm64) (push) Successful in 19s
Build and Release / Build (windows-arm64) (push) Successful in 20s
Build and Release / Create Release (push) Has been skipped
ci: display os and arch
2025-04-23 07:50:58 +08:00

68 lines
1.8 KiB
YAML

name: Build and Release
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
jobs:
build:
name: Build (${{ matrix.goos }}-${{ matrix.goarch }})
runs-on: docker
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: |
export GOOS=${{ matrix.goos }}
export GOARCH=${{ matrix.goarch }}
export CGO_ENABLED=0
go build -v -o sub-cli-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
- name: Upload build artifact
uses: forgejo/upload-artifact@v4
with:
name: sub-cli-${{ matrix.goos }}-${{ matrix.goarch }}
path: sub-cli-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
retention-days: 7
release:
name: Create Release
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: docker
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: forgejo/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Create release
id: create_release
uses: https://github.com/softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
files: |
sub-cli-linux-amd64/sub-cli-linux-amd64
sub-cli-linux-arm64/sub-cli-linux-arm64
sub-cli-darwin-amd64/sub-cli-darwin-amd64
sub-cli-darwin-arm64/sub-cli-darwin-arm64
sub-cli-windows-amd64/sub-cli-windows-amd64.exe
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}