Merge pull request #69 from asdf-vm/tb/build-release-binaries

feat(golang-rewrite): build dev release binaries
This commit is contained in:
Trevor Brown 2024-09-21 10:05:05 -04:00 committed by Trevor Brown
commit 87ac4bfe4c

View File

@ -1,8 +1,8 @@
name: Release (and build Golang binaries) name: Release (and build Golang binaries)
# This workflow should eventually replace the one in release.yml completely. # This workflow should eventually replace the one in release.yml completely.
permissions: permissions:
contents: "write" contents: write
packages: write
# Eventually this workflow will only be run when a # Eventually this workflow will only be run when a
#on: #on:
@ -42,16 +42,14 @@ on:
# docs/zh-hans/guide/getting-started.md # docs/zh-hans/guide/getting-started.md
jobs: jobs:
generate-release-tag:
create-release: name: generate-release-tag
name: create-release
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
# env: # env:
# Set to force version number, e.g., when no tag exists. # Set to force version number, e.g., when no tag exists.
# ASDF_VERSION: TEST-0.1.0 # ASDF_VERSION: TEST-0.1.0
outputs: outputs:
upload_url: ${{ steps.release.outputs.upload_url }} tag: ${{ env.ASDF_VERSION }}
asdf_version: ${{ env.ASDF_VERSION }}
steps: steps:
- name: Get the release version from the tag - name: Get the release version from the tag
shell: bash shell: bash
@ -63,8 +61,13 @@ jobs:
#echo "ASDF_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV #echo "ASDF_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# Once we're using this for real releases we'll want to change this # Once we're using this for real releases we'll want to change this
# line below to contain the actual tag name # line below to contain the actual tag name
echo "ASDF_VERSION=0.0.0" >> "$GITHUB_ENV" echo "ASDF_VERSION=$(echo "$GITHUB_SHA" | cut -c1-7)" >> "$GITHUB_ENV"
echo "version is: ${{ env.ASDF_VERSION }}" echo "version is: ${{ env.ASDF_VERSION }}"
create-release:
name: create-release
needs: generate-release-tag
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Create GitHub release - name: Create GitHub release
id: release id: release
@ -72,30 +75,36 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag: ${{ env.ASDF_VERSION }} tag: ${{ needs.generate-release-tag.outputs.tag }}
name: ${{ env.ASDF_VERSION }} name: ${{ needs.generate-release-tag.outputs.tag }}
build: build:
needs: create-release name: Build Go release binaries
needs: [create-release, generate-release-tag]
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
# windows isn't working on windows right now, add it to this list once
# I fix the code.
goos: [linux, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
#- goarch: arm64
# goos: windows
steps: steps:
- - name: Checkout
name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- - name: Build Go binaries
name: Set up Go uses: wangyoucao577/go-release-action@v1
uses: actions/setup-go@v4
with: with:
go-version: '1.21.5' github_token: ${{ secrets.GITHUB_TOKEN }}
cache: true goos: ${{ matrix.goos }}
- goarch: ${{ matrix.goarch }}
name: Run GoReleaser goversion: "1.21.5"
# Downgraded to version 4 to get snapshot feature working binary_name: "asdf"
uses: goreleaser/goreleaser-action@v4 release_tag: ${{ needs.generate-release-tag.outputs.tag }}
with: release_name: ${{ needs.generate-release-tag.outputs.tag }}
version: latest
args: release --clean --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}