Use gitea actions to build releases
Some checks failed
Build / build (push) Failing after 1m34s

This commit is contained in:
Timothée Floure 2024-04-24 16:42:01 +02:00
parent 9c58b4a7d5
commit 6dcbc651d1
Signed by: tfloure
GPG key ID: 4502C902C00A1E12
4 changed files with 22 additions and 141 deletions

View file

@ -0,0 +1,22 @@
name: Build
on:
push:
branches:
- main
jobs:
build:
runs-on: alpine-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: |
apk add go make
export GOPATH=/tmp/go
export PATH=$PATH:$GOPATH/bin
make build
- uses: actions/upload-artifact@v4
with:
name: mystrom-exporter
path: output/mystrom-exporter
overwrite: true

View file

@ -1,50 +0,0 @@
name: Create and publish a Docker image
on:
push:
branches: ['main']
tags:
- '*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64,linux/arm64, linux/arm
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View file

@ -1,32 +0,0 @@
---
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: install stringer
run: go install golang.org/x/tools/cmd/stringer@latest
- name: Generate
run: go generate ./...
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...

View file

@ -1,59 +0,0 @@
# .github/workflows/release.yaml
on:
release:
types: [created]
jobs:
release-linux-amd64:
name: release linux/amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1.30
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
goarch: amd64
pre_command: |
go install golang.org/x/tools/cmd/stringer@latest
&& go generate ./...
release-linux-arm64:
name: release linux/arm64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1.30
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
goarch: arm64
pre_command: |
go install golang.org/x/tools/cmd/stringer@latest
&& go generate ./...
release-linux-arm:
name: release linux/arm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1.30
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
goarch: arm
pre_command: |
go install golang.org/x/tools/cmd/stringer@latest
&& go generate ./...
release-darwin-amd64:
name: release darwin/amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1.30
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: darwin
goarch: amd64
pre_command: |
go install golang.org/x/tools/cmd/stringer@latest
&& go generate ./...