Skip to content

Commit

Permalink
CD: assets as zip (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thykof authored Mar 17, 2023
1 parent beb5201 commit c9c11de
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 29 deletions.
35 changes: 30 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ on:
push:
branches: [ main ]
workflow_call:
inputs:
tag_name:
type: string
draft:
type: string
prerelease:
type: string
generate_release_notes:
type: string

jobs:
build:
Expand All @@ -15,6 +24,7 @@ jobs:
- os: ubuntu-latest
arch: amd64
target: windows
ext: .exe
# The second combination is Ubuntu running on an AMD64 processor, building for Linux.
- os: ubuntu-latest
arch: amd64
Expand All @@ -30,6 +40,8 @@ jobs:

# The build job runs on the specified operating system.
runs-on: ${{ matrix.os }}
env:
TARGET_NAME: thyra-plugin-wallet_${{ matrix.target }}-${{ matrix.arch }}
steps:
# The first step checks out the repository.
- uses: actions/checkout@v3
Expand All @@ -56,11 +68,24 @@ jobs:
export CC=x86_64-w64-mingw32-gcc
fi
export GOOS=${{ matrix.target }}
export GOARCH=${{ matrix.arch }}
./build.sh
export GOARCH=${{ matrix.arch }}
export CGO_ENABLED=1
go build -o $TARGET_NAME${{ matrix.ext }} cmd/massa-wallet/thyra-plugin-wallet.go
- name: Upload artifacts
if: ${{ inputs.tag_name == '' && github.ref_name == 'main' }}
uses: actions/upload-artifact@v3
with:
# Name the artifact using the values of the matrix.target and matrix.arch variables
name: Wallet-plugin-${{ matrix.target }}_${{ matrix.arch }}
path: build/wallet-plugin
name: thyra-plugin-wallet_${{ matrix.target }}-${{ matrix.arch }}
path: ${{ env.TARGET_NAME }}${{ matrix.ext }}
- name: Zip binary
if: ${{ inputs.tag_name != '' }}
run: zip $TARGET_NAME.zip $TARGET_NAME${{ matrix.ext }}
- name: Create release and upload binaries
if: ${{ inputs.tag_name != '' }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ inputs.tag_name }}
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
generate_release_notes: ${{ inputs.generate_release_notes }}
files: "*.zip"
34 changes: 10 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,30 @@ name: Release workflow
on:
workflow_dispatch:
inputs:
release-version:
tag_name:
description: "Version to produce"
required: true
release-as-draft:
draft:
description: "Whether it's a draft or not"
required: true
type: boolean
default: true
release-as-prerelease:
prerelease:
description: "Whether it's a prerelease or not"
required: true
type: boolean
default: false
generate-release-notes:
generate_release_notes:
description: "Generate release notes"
required: true
type: boolean
default: true

jobs:
build:
build-release:
uses: ./.github/workflows/build.yml

release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- run: |
mv ./Wallet-plugin-linux_amd64/thyra-plugin-wallet thyra-plugin-wallet-linux_amd64
mv ./Wallet-plugin-darwin_arm64/thyra-plugin-wallet thyra-plugin-wallet-darwin_arm64
mv ./Wallet-plugin-darwin_amd64/thyra-plugin-wallet thyra-plugin-wallet-darwin_amd64
mv ./Wallet-plugin-windows_amd64/thyra-plugin-wallet thyra-plugin-wallet-windows_amd64
- name: Create release and upload binaries
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.release-version }}
draft: ${{ github.event.inputs.release-as-draft }}
prerelease: ${{ github.event.inputs.release-as-prerelease }}
generate_release_notes: ${{ github.event.inputs.generate-release-notes }}
files: ./thyra-plugin-wallet-*
with:
tag_name: ${{ github.event.inputs.tag_name }}
draft: ${{ github.event.inputs.draft }}
prerelease: ${{ github.event.inputs.prerelease }}
generate_release_notes: ${{ github.event.inputs.generate_release_notes }}

0 comments on commit c9c11de

Please sign in to comment.