Merge pull request #492 from ppc64le-cloud/dependabot/go_modules/gith… #44
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*' | |
env: | |
GO_VERSION: "1.20" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get the target release version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- name: Set up Go ${{ env.GO_VERSION }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Build | |
run: | | |
mkdir -p bin | |
VERSION=${{ steps.get_version.outputs.VERSION }} | |
STATIC_FLAG='-w -extldflags "-static"' | |
for platform in darwin/amd64 darwin/arm64 linux/amd64 linux/ppc64le windows/amd64 | |
do | |
os_name=$(echo "$platform" | cut -d "/" -f 1) | |
arch=$(echo "$platform" | cut -d "/" -f 2) | |
CGO_ENABLED=0 GOOS=${os_name} GOARCH=${arch} go build -a -tags netgo -ldflags "-X github.com/ppc64le-cloud/pvsadm/pkg/version.Version=${VERSION} ${STATIC_FLAG}" -o bin/${os_name}-${arch}/pvsadm . | |
tar -czvf pvsadm-${os_name}-${arch}.tar.gz -C bin/${os_name}-${arch} pvsadm | |
done | |
tar -czvf pvsadm-binaries.tar.gz bin/ | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ steps.get_version.outputs.VERSION }} | |
draft: true | |
prerelease: true | |
- name: Upload linux - amd64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/linux-amd64/pvsadm | |
asset_name: pvsadm-linux-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload linux - amd64 - tar.gz | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: pvsadm-linux-amd64.tar.gz | |
asset_name: pvsadm-linux-amd64.tar.gz | |
asset_content_type: application/tar+gzip | |
- name: Upload linux - ppc64le | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/linux-ppc64le/pvsadm | |
asset_name: pvsadm-linux-ppc64le | |
asset_content_type: application/octet-stream | |
- name: Upload linux - ppc64le - tar.gz | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: pvsadm-linux-ppc64le.tar.gz | |
asset_name: pvsadm-linux-ppc64le.tar.gz | |
asset_content_type: application/tar+gzip | |
- name: Upload darwin/amd64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/darwin-amd64/pvsadm | |
asset_name: pvsadm-darwin-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload darwin/amd64 - tar.gz | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: pvsadm-darwin-amd64.tar.gz | |
asset_name: pvsadm-darwin-amd64.tar.gz | |
asset_content_type: application/tar+gzip | |
- name: Upload darwin/arm64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/darwin-arm64/pvsadm | |
asset_name: pvsadm-darwin-arm64 | |
asset_content_type: application/octet-stream | |
- name: Upload darwin/arm64 - tar.gz | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: pvsadm-darwin-arm64.tar.gz | |
asset_name: pvsadm-darwin-arm64.tar.gz | |
asset_content_type: application/tar+gzip | |
- name: Upload Windows - amd64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/windows-amd64/pvsadm | |
asset_name: pvsadm-windows-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload Windows - amd64 - tar.gz | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: pvsadm-windows-amd64.tar.gz | |
asset_name: pvsadm-windows-amd64.tar.gz | |
asset_content_type: application/tar+gzip | |
- name: Upload all | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: pvsadm-binaries.tar.gz | |
asset_name: pvsadm-binaries.tar.gz | |
asset_content_type: application/tar+gzip |