Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more binaries and release them all #403

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 30 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,46 @@
name: Release

on:
release:
types: [published]
push:
tags:
- v*

jobs:

build:
name: Build release binaries
runs-on: ubuntu-latest

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
id: go

- name: Build AMD64
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -installsuffix nocgo -v -o traefik-forward-auth_amd64 ./cmd

- name: Build ARM
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GO111MODULE=on go build -a -installsuffix nocgo -v -o traefik-forward-auth_arm ./cmd
uses: actions/checkout@v4

- name: Get tag name
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Get artifact details
uses: octokit/[email protected]
id: get_release_details
- name: Setup Go
uses: actions/setup-go@v5
with:
route: get /repos/${{ github.repository }}/releases/tags/${{ env.TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
go-version-file: go.mod

- name: Upload AMD64 release asset
uses: actions/upload-release-asset@v1
- name: Build Binaries
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ fromJson(steps.get_release_details.outputs.data).upload_url }}
asset_path: traefik-forward-auth_amd64
asset_name: traefik-forward-auth_amd64
asset_content_type: application/octet-stream

- name: Upload ARM release asset
uses: actions/upload-release-asset@v1
CGO_ENABLED: 0
GO111MODULE: on
run: |
platforms=(linux windows darwin)
architectures=(amd64 arm64 arm)

for platform in "${platforms[@]}"; do
for arch in "${architectures[@]}"; do
[[ ("${platform}" == "windows" || "${platform}" == "darwin") && "${arch}" == "arm" ]] && continue

echo "Building Traefik-Forward-Auth for ${platform}-${arch}"
GOOS="${platform}" GOARCH="${arch}" go build -a -installsuffix nocgo -o traefik-forward-auth ./cmd
tar cJvf "traefik-forward-auth_${platform}_${arch}.tar.xz" traefik-forward-auth
rm traefik-forward-auth
done
done

- name: Upload Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ fromJson(steps.get_release_details.outputs.data).upload_url }}
asset_path: traefik-forward-auth_arm
asset_name: traefik-forward-auth_arm
asset_content_type: application/octet-stream
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${GITHUB_REF_NAME} *.tar.xz