Skip to content

Merge pull request #209 from bytecodealliance/ydnar/v0.3.0 #6

Merge pull request #209 from bytecodealliance/ydnar/v0.3.0

Merge pull request #209 from bytecodealliance/ydnar/v0.3.0 #6

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.*'
jobs:
build:
permissions:
contents: write
name: Build Binaries
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
exclude:
- goos: windows
goarch: arm64
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run Go tests
run: go test -v ./...
- name: Build Binary
run: |
mkdir -p build
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o wit-bindgen-go ./cmd/wit-bindgen-go
tar -czvf build/wit-bindgen-go-${{ matrix.goos }}-${{ matrix.goarch }}.tgz wit-bindgen-go
rm wit-bindgen-go
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: wit-bindgen-go_${{ matrix.goos }}_${{ matrix.goarch }}
path: build/wit-bindgen-go-${{ matrix.goos }}-${{ matrix.goarch }}.tgz
retention-days: 1
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: build/
merge-multiple: true # all artifacts are downloaded to this directory
- name: Extract Release Notes
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
cd $GITHUB_WORKSPACE
./scripts/extract-changelog.sh $TAG_NAME > RELEASE_NOTES.md
cat RELEASE_NOTES.md
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls -R build/
TAG_NAME=${GITHUB_REF#refs/tags/}
if [[ "$TAG_NAME" =~ .+-pre.* ]]; then
PRERELEASE_ARGS="--prerelease --latest=false"
else
PRERELEASE_ARGS=""
fi
gh release create "${{ github.ref_name }}" \
--notes-file RELEASE_NOTES.md \
--title "${{ github.ref_name }}" \
$PRERELEASE_ARGS \
build/*