Skip to content

Making changes to release workflow #3

Making changes to release workflow

Making changes to release workflow #3

Workflow file for this run

name: Release
on: push
env:
APP: fv
GO_VERSION: stable
jobs:
build_for_linux:
name: Build for Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [amd64, arm, arm64]
steps:
- name: Install build dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y \
build-essential \
qemu-user \
gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
libstdc++6-armhf-cross \
libstdc++6-arm64-cross \
libc6-dev-armhf-cross \
libc6-dev-arm64-cross \
file
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Build ${{ matrix.arch }}
run: ./build.sh -v ${{ github.ref_name }} -a ${{ matrix.arch }}
- name: Build ${{ matrix.arch }} (static)
if: matrix.arch != 'arm'
run: ./build.sh -v ${{ github.ref_name }} -a ${{ matrix.arch }} -s
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist-linux-${{ matrix.arch }}
path: build/linux/*/*/$APP*.tar.bz2
build_for_macos:
name: Build for macOS
runs-on: macos-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Install build dependencies
run: brew install coreutils
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Build ${{ matrix.arch }}
run: |
./build.sh -v ${{ github.ref_name }} -a ${{ matrix.arch }}
file build/darwin/*/*/$APP
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist-darwin-${{ matrix.arch }}
path: build/darwin/*/*/$APP*.tar.bz2
build_for_macos_universal:
name: Build for macOS (universal)
needs:
- build_for_macos
runs-on: macos-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Build universal
run: |
export WORKDIR=/tmp/$APP-universal
mkdir -p $WORKDIR
tar -jxvf dist-darwin-amd64/*/*/$APP*.tar.bz2 -C $WORKDIR $APP
mv $WORKDIR/$APP $WORKDIR/$APP-amd64
tar -jxvf dist-darwin-arm64/*/*/$APP*.tar.bz2 -C $WORKDIR $APP
mv $WORKDIR/$APP $WORKDIR/$APP-arm64
lipo -create -output $WORKDIR/$APP $WORKDIR/$APP-amd64 $WORKDIR/$APP-arm64
$WORKDIR/$APP --version
rm $WORKDIR/$APP-{amd64,arm64}
tar -jxvf dist-darwin-amd64/*/*/$APP*.tar.bz2 -C $WORKDIR LICENSE
tar -C $WORKDIR -cjf $APP-${GITHUB_REF_NAME#v}-darwin-universal.tar.bz2
ls -alh $APP*
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist-darwin-universal
path: ./$APP*.tar.bz2
build_for_windows:
name: Build for Windows
runs-on: windows-latest
steps:
- name: Install build dependencies
run: choco install zip
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Build amd64
shell: bash
run: ./build.sh -v ${{ github.ref_name }}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist-windows
path: build/windows/*/*/$APP*.zip
release:
name: Draft Release
needs:
- build_for_linux
- build_for_macos
- build_for_windows
- build_for_macos_universal
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: $APP ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
generate_release_notes: true
files: dist-*/*/*/$APP*.*