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 1ab256335f

View File

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