Skip to content

Commit

Permalink
ci: Test the matrix workflow update
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsNieuwenhuizen committed Jul 24, 2024
1 parent f1d2220 commit 4acfc1d
Showing 1 changed file with 77 additions and 28 deletions.
105 changes: 77 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,85 @@ jobs:
- uses: ./.github/actions/define-release-version
id: info

build-and-release:
build:
runs-on: ubuntu-latest
environment: Release
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

- name: Set up Go 1.22
uses: actions/setup-go@v5
with:
go-version: 1.22
id: go

- name: Build
shell: bash
run: ./build.sh ${{ needs.version.outputs.release_version }}

- name: Check the created tarballs
shell: bash
run: |
ls -al 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
- 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

0 comments on commit 4acfc1d

Please sign in to comment.