From 6dcbc651d1a5afd830caf30d9fe526040a3b26dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Wed, 24 Apr 2024 16:42:01 +0200 Subject: [PATCH] Use gitea actions to build releases --- .gitea/workflows/build.yml | 22 +++++++++++ .github/workflows/docker-image.yml | 50 ------------------------- .github/workflows/go.yml | 32 ---------------- .github/workflows/release.yml | 59 ------------------------------ 4 files changed, 22 insertions(+), 141 deletions(-) create mode 100644 .gitea/workflows/build.yml delete mode 100644 .github/workflows/docker-image.yml delete mode 100644 .github/workflows/go.yml delete mode 100644 .github/workflows/release.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..4932de2 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -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 diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 43daaed..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -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 }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 9af3c4a..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -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 ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index d43cecd..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -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 ./... \ No newline at end of file