Merge pull request #736 from ppc64le-cloud/dependabot/go_modules/gith… #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload Release Asset | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- { os: darwin, arch: amd64 } | |
- { os: darwin, arch: arm64 } | |
- { os: linux, arch: amd64 } | |
- { os: linux, arch: ppc64le } | |
- { os: windows, arch: amd64 } | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Get the target release version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Build | |
run: | | |
mkdir -p bin/ | |
STATIC_FLAG='-w -extldflags "-static"' | |
VERSION=${{ steps.get_version.outputs.VERSION }} | |
CGO_ENABLED=0 GOOS=${{ matrix.platform.os }} GOARCH=${{ matrix.platform.arch }} \ | |
go build -a -tags netgo -ldflags "-X github.com/ppc64le-cloud/pvsadm/pkg/version.Version=${VERSION} ${STATIC_FLAG}" \ | |
-o bin/pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }} | |
tar -czvf pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz -C bin/ pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }} | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }} | |
path: | | |
bin/pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }} | |
pvsadm-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: ${{ success() }} | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./downloaded-artifacts | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
name: Release ${{ steps.get_version.outputs.VERSION }} | |
draft: true | |
prerelease: true | |
generate_release_notes: true | |
files: | | |
./downloaded-artifacts/** |