From 625f3a839ff0d4881693508c758d9161d8603d52 Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Fri, 10 Nov 2023 06:38:54 +0700 Subject: [PATCH] Attempt to make release workflow generic --- .github/workflows/release.yml | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 28227e9..f1b80c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,7 @@ name: Release on: push env: APP: fv + VER: ${{ github.ref_name }} GO_VERSION: stable jobs: @@ -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: @@ -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 @@ -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: @@ -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: @@ -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