Skip to content

Commit

Permalink
Attempt to make release workflow generic
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Nov 9, 2023
1 parent 85a8fa5 commit 625f3a8
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Release
on: push
env:
APP: fv
VER: ${{ github.ref_name }}
GO_VERSION: stable

jobs:
Expand Down Expand Up @@ -35,10 +36,14 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}
- name: Build ${{ matrix.arch }}
run: ./build.sh -v ${{ github.ref_name }} -a ${{ matrix.arch }}
run: |
./build.sh -v $VER -a ${{ matrix.arch }}
file build/linux/*/*/$APP
- name: Build ${{ matrix.arch }} (static)
if: matrix.arch != 'arm'
run: ./build.sh -v ${{ github.ref_name }} -a ${{ matrix.arch }} -s
run: |
./build.sh -v $VER -a ${{ matrix.arch }} -s
file build/linux/*/*/${APP}_static
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
Expand All @@ -63,7 +68,7 @@ jobs:
go-version: ${{ env.GO_VERSION }}
- name: Build ${{ matrix.arch }}
run: |
./build.sh -v ${{ github.ref_name }} -a ${{ matrix.arch }}
./build.sh -v $VER -a ${{ matrix.arch }}
file build/darwin/*/*/$APP
- name: Archive artifacts
uses: actions/upload-artifact@v3
Expand All @@ -82,23 +87,28 @@ jobs:
uses: actions/download-artifact@v3
- name: Build universal
run: |
export WORKDIR=/tmp/$APP-universal
export WORKDIR=$PWD/build/$VER/darwin/universal
mkdir -p $WORKDIR
tar -jxvf dist-darwin-amd64/*/*/*.tar.bz2 -C $WORKDIR $APP
tar -jxvf dist-darwin-amd64/*/*/*.tar.bz2 -C $WORKDIR LICENSE
mv $WORKDIR/$APP $WORKDIR/$APP-amd64
tar -jxvf dist-darwin-arm64/*/*/*.tar.bz2 -C $WORKDIR $APP
mv $WORKDIR/$APP $WORKDIR/$APP-arm64
lipo -create -output $WORKDIR/$APP $WORKDIR/$APP-amd64 $WORKDIR/$APP-arm64
file build/darwin/*/*/$APP
$WORKDIR/$APP --version
rm $WORKDIR/$APP-{amd64,arm64}
tar -jxvf dist-darwin-amd64/*/*/*.tar.bz2 -C $WORKDIR LICENSE
tar -C $WORKDIR -cjf $APP-${GITHUB_REF_NAME#v}-darwin-universal.tar.bz2
ls -alh $APP*
tar -C $WORKDIR -cjf $WORKDIR/$APP-${VER#v}-darwin-universal.tar.bz2
ls -alh $WORKDIR/*.tar.bz2
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist-darwin-universal
path: ./*.tar.bz2
path: build/darwin/**/*.tar.bz2
if-no-files-found: error

# build_for_windows:
Expand All @@ -115,7 +125,7 @@ jobs:
# go-version: ${{ env.GO_VERSION }}
# - name: Build amd64
# shell: bash
# run: ./build.sh -v ${{ github.ref_name }}
# run: ./build.sh -v $VER
# - name: Archive artifacts
# uses: actions/upload-artifact@v3
# with:
Expand All @@ -138,7 +148,7 @@ jobs:
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: $APP ${{ github.ref_name }}
name: $APP $VER
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
generate_release_notes: true
Expand Down

0 comments on commit 625f3a8

Please sign in to comment.