Skip to content

ci: test

ci: test #1

Workflow file for this run

name: Build Release
on:
push:
tags:
- 'v*.*.*'
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Generate release notes
run: |
npx auto-changelog-plus --starting-version ${{ github.ref_name }}
sed -i '1,4d' CHANGELOG.md
- name: Upload changelog
uses: actions/upload-artifact@v4
with:
name: changelog
path: CHANGELOG.md
build:
runs-on: ${{ matrix.os }}
needs: changelog
if: always() && (needs.changelog.result == 'success' || needs.changelog.result == 'skipped')
strategy:
fail-fast: false
matrix:
include:
# ===== Windows =====
- os: windows-latest
goos: windows
goarch: amd64
platform: windows-amd64
ext: .exe
# ===== Linux =====
- os: ubuntu-latest
goos: linux
goarch: amd64
platform: linux-amd64
ext: ""
- os: ubuntu-22.04
goos: linux
goarch: arm64
platform: linux-arm64
ext: ""
- os: ubuntu-22.04
goos: linux
goarch: arm
goarm: "7"
platform: linux-armv7
ext: ""
# ===== macOS =====
- os: macos-15-intel
goos: darwin
goarch: amd64
platform: darwin-amd64
ext: ""
- os: macos-latest
goos: darwin
goarch: arm64
platform: darwin-arm64
ext: ""
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: src/go.mod
- name: Build
shell: bash
run: |
export CGO_ENABLED=0
export GOOS=${{ matrix.goos }}
export GOARCH=${{ matrix.goarch }}
[ -n "${{ matrix.goarm }}" ] && export GOARM=${{ matrix.goarm }}
cd src
go build \
-ldflags "-s -w -X main.version=${{ github.ref_name }}" \
-o ../dist/portrelay${{ matrix.ext }} \
.
- name: Rename binary
shell: bash
run: |
mkdir -p dist
mv dist/portrelay${{ matrix.ext }} \
dist/PortRelay-${{ github.ref_name }}-${{ matrix.platform }}${{ matrix.ext }}
- name: Package (Linux / macOS)
if: runner.os != 'Windows'
run: |
cd dist
zip ../PortRelay-${{ github.ref_name }}-${{ matrix.platform }}.zip \
PortRelay-${{ github.ref_name }}-${{ matrix.platform }}${{ matrix.ext }}
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path "dist\PortRelay-${{ github.ref_name }}-${{ matrix.platform }}${{ matrix.ext }}" `
-DestinationPath "PortRelay-${{ github.ref_name }}-${{ matrix.platform }}.zip"
- name: Download changelog
uses: actions/download-artifact@v4
with:
name: changelog
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
files: PortRelay-${{ github.ref_name }}-${{ matrix.platform }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}