Use gitea actions to build releases
All checks were successful
Build / build (push) Successful in 1m30s
All checks were successful
Build / build (push) Successful in 1m30s
This commit is contained in:
parent
9c58b4a7d5
commit
2216ac4085
4 changed files with 23 additions and 141 deletions
23
.gitea/workflows/build.yml
Normal file
23
.gitea/workflows/build.yml
Normal 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
|
50
.github/workflows/docker-image.yml
vendored
50
.github/workflows/docker-image.yml
vendored
|
@ -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 }}
|
32
.github/workflows/go.yml
vendored
32
.github/workflows/go.yml
vendored
|
@ -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 ./...
|
59
.github/workflows/release.yml
vendored
59
.github/workflows/release.yml
vendored
|
@ -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 ./...
|
Loading…
Reference in a new issue