Skip to content

fix: use explicit tag for push #1

fix: use explicit tag for push

fix: use explicit tag for push #1

Workflow file for this run

---
name: Release
on:
push:
tags: [ "*" ]
jobs:
build-linux:
name: Build (Linux)
strategy:
matrix:
version: [1.22.x]
runs-on: ubuntu-latest
steps:
- name: Set up cross toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Set up toolchain
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.version }}
id: go
- name: Check out code
uses: actions/checkout@v4
- name: Build binary
run: |
CGO_ENABLED=1 GOARCH=amd64 make ghostunnel
mv ghostunnel ghostunnel-linux-amd64
make clean
CGO_ENABLED=1 GOARCH=arm64 CC=aarch64-linux-gnu-gcc make ghostunnel
mv ghostunnel ghostunnel-linux-arm64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ghostunnel-linux-amd64
path: ghostunnel-linux-amd64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ghostunnel-linux-arm64
path: ghostunnel-linux-arm64
build-darwin:
name: Build (MacOS)
strategy:
matrix:
version: [1.22.x]
runs-on: macos-latest
steps:
- name: Set up toolchain
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.version }}
id: go
- name: Check out code
uses: actions/checkout@v4
- name: Build binary
run: |
CGO_ENABLED=1 GOARCH=amd64 make ghostunnel
mv ghostunnel ghostunnel-darwin-amd64
make clean
CGO_ENABLED=1 GOARCH=arm64 make ghostunnel
mv ghostunnel ghostunnel-darwin-arm64
lipo -create -output ghostunnel-darwin-universal ghostunnel-darwin-amd64 ghostunnel-darwin-arm64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ghostunnel-darwin-amd64
path: ghostunnel-darwin-amd64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ghostunnel-darwin-arm64
path: ghostunnel-darwin-arm64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ghostunnel-darwin-universal
path: ghostunnel-darwin-universal
build-windows:
name: Build (Windows)
strategy:
matrix:
version: [1.22.x]
runs-on: windows-latest
steps:
- name: Set up toolchain
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.version }}
id: go
- name: Check out code
uses: actions/checkout@v4
- name: Build binary
run: |
make ghostunnel
mv ghostunnel ghostunnel-windows-amd64.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ghostunnel-windows-amd64.exe
path: ghostunnel-windows-amd64.exe
release:
name: Create release
runs-on: ubuntu-latest
needs: [ build-linux, build-darwin, build-windows ]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v4
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: "Release Build (Draft)"
body: "Release Build (from ${{ github.ref }}/${{ github.sha }})"
draft: true
prerelease: true
add-assets-linux-darwin:
name: Add assets for Linux/Darwin
runs-on: ubuntu-latest
needs: [ build-linux, build-darwin, release ]
strategy:
matrix:
target:
- { os: 'linux', arch: 'amd64' }
- { os: 'linux', arch: 'arm64' }
- { os: 'darwin', arch: 'amd64' }
- { os: 'darwin', arch: 'arm64' }
- { os: 'darwin', arch: 'universal' }
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ghostunnel-${{ matrix.target.os }}-${{ matrix.target.arch }}
path: dist
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./dist/ghostunnel-${{ matrix.target.os }}-${{ matrix.target.arch }}
asset_name: ghostunnel-${{ matrix.target.os }}-${{ matrix.target.arch }}
asset_content_type: application/octet-stream
add-assets-windows:
name: Add assets for Windows
runs-on: ubuntu-latest
needs: [ build-windows, release ]
strategy:
matrix:
target:
- { os: 'windows', arch: 'amd64' }
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ghostunnel-${{ matrix.target.os }}-${{ matrix.target.arch }}.exe
path: dist
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./dist/ghostunnel-${{ matrix.target.os }}-${{ matrix.target.arch }}.exe
asset_name: ghostunnel-${{ matrix.target.os }}-${{ matrix.target.arch }}.exe
asset_content_type: application/octet-stream