Try out a release flow and add cross-compiling builds.
Some checks failed
release / docker-release-latest (push) Failing after 1s
test / test (push) Successful in 3m33s
release / go-release-tag (push) Failing after 15m11s
build / build (push) Has been cancelled
release / docker-release-tag (push) Has been cancelled

This commit is contained in:
Seraphim R. Pardee 2024-09-20 23:19:31 -04:00
parent fc97711464
commit af4d473ac0
3 changed files with 92 additions and 1 deletions

View File

@ -6,6 +6,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: docker qemu setup
uses: docker/setup-qemu-action@v3
- name: docker buildx setup - name: docker buildx setup
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: login to container registry - name: login to container registry

View File

@ -0,0 +1,85 @@
name: release
run-name: ${{ gitea.actor }} is releasing.
on:
push:
tags:
- '*'
jobs:
docker-release-tag:
runs-on: ubuntu-latest
steps:
- name: docker qemu setup
uses: docker/setup-qemu-action@v3
- name: docker buildx setup
uses: docker/setup-buildx-action@v3
- name: login to container registry
uses: docker/login-action@v3
with:
registry: git.hl.srp.life
username: ${{ gitea.repository_owner }}
password: ${{ secrets.ACTIONS_KEY }}
- name: checkout code
uses: actions/checkout@v4
- name: build and push to registry
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
git.hl.srp.life/${{ gitea.repository }}:${{ gitea.ref_name }}
docker-release-latest:
if: ${{ ! (endsWith(gitea.ref_name, "-alpha") || endsWith(gitea.ref_name, "-beta") || endsWith(gitea.ref_name, "-rc")) }}
runs-on: ubuntu-latest
steps:
- name: docker qemu setup
uses: docker/setup-qemu-action@v3
- name: docker buildx setup
uses: docker/setup-buildx-action@v3
- name: login to container registry
uses: docker/login-action@v3
with:
registry: git.hl.srp.life
username: ${{ gitea.repository_owner }}
password: ${{ secrets.ACTIONS_KEY }}
- name: checkout code
uses: actions/checkout@v4
- name: build and push to registry
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
git.hl.srp.life/${{ gitea.repository }}:latest
go-release-tag:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: gotta build 'em all
uses: thatisuday/go-cross-build@v1
with:
platforms: 'linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, freebsd/amd64, netbsd/amd64, openbsd/amd64, windows/amd64'
name: bingo
package: ''
compress: true
dest: dist
- name: push to go package registry
run: |
for i in dist/*; do
curl --user ${{ gitea.repository_owner }}:${{ secrets.ACTIONS_KEY }} --upload-file $i https://git.hl.srp.life/api/packages/${{ gitea.repository_owner }}/go/upload
done
- name: publish release
uses: https://gitea.com/actions/release-action@main
with:
files: |-
dist/**
api_key: ${{ secrets.ACTIONS_KEY }}

View File

@ -1,10 +1,14 @@
FROM golang:1.23 FROM golang:1.23
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app WORKDIR /app
COPY . ./ COPY . ./
RUN go mod download RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o /bingo RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /bingo
EXPOSE 3005 EXPOSE 3005
CMD [ "/bingo", "run" ] CMD [ "/bingo", "run" ]