Merge pull request #18 from ironbeer/feature/pprof #20
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: Release | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
os: [linux] | |
arch: [amd64, arm64] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Setup Go 1.18 | |
if: matrix.arch == 'amd64' | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.18 | |
- name: Build Binary - ${{ matrix.os }} ${{ matrix.arch }} | |
if: matrix.arch == 'amd64' | |
run: | | |
go get -v -t -d ./... | |
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} CGO_ENABLED=1 \ | |
go build -a -o oasvlfy -tags netgo -installsuffix netgo --ldflags='-s -w -extldflags "-static"' -buildvcs=false | |
- name: Build Binary - ${{ matrix.os }} ${{ matrix.arch }} | |
if: matrix.arch == 'arm64' | |
run: | | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
docker run --rm -t \ | |
-v ${{ github.workspace }}:${{ github.workspace }} \ | |
-w ${{ github.workspace }} \ | |
-e GOOS=${{ matrix.os }} -e GOARCH=${{ matrix.arch }} -e CGO_ENABLED=1 \ | |
arm64v8/golang:1.18-buster \ | |
go build -a -o oasvlfy -tags netgo -installsuffix netgo --ldflags='-s -w -extldflags "-static"' -buildvcs=false | |
- name: Compress Binary | |
run: zip oasvlfy-${{ matrix.os }}-${{ matrix.arch }}.zip ./oasvlfy | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ github.ref_name }} | |
path: oasvlfy-${{ matrix.os }}-${{ matrix.arch }}.zip | |
release: | |
name: Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Download Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ github.ref_name }} | |
path: artifacts | |
- name: Create sha256sums.txt | |
run: (cd artifacts && sha256sum *) > sha256sums.txt | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
draft: true | |
- name: Upload Asset - Linux x86_64 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: artifacts/oasvlfy-linux-amd64.zip | |
asset_name: oasvlfy-${{ github.ref_name }}-linux-amd64.zip | |
asset_content_type: application/zip | |
- name: Upload Asset - Linux arm64 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: artifacts/oasvlfy-linux-arm64.zip | |
asset_name: oasvlfy-${{ github.ref_name }}-linux-arm64.zip | |
asset_content_type: application/zip | |
- name: Upload Asset - sha256sums.txt | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: sha256sums.txt | |
asset_name: sha256sums.txt | |
asset_content_type: text/plain | |
container: | |
name: Container | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Setup QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: amd64,arm64 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ghcr.io/${{ github.repository }}/verse-verifier:${{ github.ref_name }} |