Use gitea actions to build releases
Build / build (push) Successful in 1m30s Details

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

View File

@ -0,0 +1,23 @@
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@v3
with:
name: mystrom-exporter
path: output/mystrom-exporter
compression-level: 0 # no compression
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 ./...