Release #24
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
# Build a the loadbalancer binary on a release | |
name: Release | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- closed | |
permissions: | |
contents: write | |
jobs: | |
test: | |
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true | |
uses: LarsNieuwenhuizen/loadbalancer/.github/workflows/test.yml@main | |
version: | |
runs-on: ubuntu-latest | |
needs: test | |
outputs: | |
release_version: ${{ steps.info.outputs.release_version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: ./.github/actions/define-release-version | |
id: info | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- version | |
strategy: | |
matrix: | |
os-arch-combinations: | |
- arch: amd64 | |
os: linux | |
- arch: arm64 | |
os: linux | |
- arch: arm | |
os: linux | |
- arch: amd64 | |
os: darwin | |
- arch: arm64 | |
os: darwin | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
id: go | |
- name: Build | |
shell: bash | |
run: | | |
sed -i "s/##VERSION##/${{ needs.version.outputs.release_version}}/g" cmd/root.go | |
GOOS=${{ matrix.os-arch-combinations.os }} GOARCH=${{ matrix.os-arch-combinations.arch }} go build --ldflags '-extldflags "-static"' -o bin/loadbalancer main/main.go | |
cd bin | |
tar -czvf "loadbalancer-${{ matrix.os-arch-combinations.os }}-${{ matrix.os-arch-combinations.arch }}.tar.gz" loadbalancer | |
rm loadbalancer | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifact | |
path: bin/*.tar.gz | |
middle-step: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-artifact | |
path: bin | |
- name: Check the created tarballs | |
shell: bash | |
run: | | |
ls -al bin | |
# release: | |
# runs-on: ubuntu-latest | |
# environment: Release | |
# needs: | |
# - middle-step | |
# - version | |
# - build | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: build-artifact | |
# path: bin | |
# - name: Create a release commit | |
# env: | |
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# run: | | |
# git config user.name "GitHub Actions" | |
# git config user.email "[email protected]" | |
# git commit -m "release: ${{ needs.version.outputs.release_version }}" --allow-empty | |
# git push origin main --tags | |
# gh release create ${{ needs.version.outputs.release_version }} ./bin/*.tar.gz --generate-notes |