automate goreleaser

This commit is contained in:
Michał Adamski
2025-02-04 20:24:57 +01:00
parent 31235a9ed6
commit 7979c54459
3 changed files with 43 additions and 32 deletions

View File

@@ -1,31 +0,0 @@
name: Docker Build & Push (Tags Only)
on:
push:
tags:
- '[0-9]*' # triggers for version tag pushed
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Check out code
uses: actions/checkout@v3
# Step 2: Log in to Docker Hub
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u meehow --password-stdin
# Step 3: Build the Docker image
- name: Build Docker image
run: |
docker build -t meehow/privtracker:latest \
-t meehow/privtracker:${{ github.ref_name }} .
# Step 4: Push the Docker image
- name: Push Docker image
run: |
docker push meehow/privtracker:latest
docker push meehow/privtracker:${{ github.ref_name }}

40
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Release
on:
push:
tags:
- '[0-9]*' # triggers for version tag pushed
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: meehow
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags:
- meehow/privtracker:latest
- meehow/privtracker:${{ github.ref_name }}

View File

@@ -25,6 +25,8 @@ builds:
ignore:
- goos: windows
goarch: arm64
flags: -trimpath
ldflags: -s -w -buildid=
archives:
- formats: tar.gz
@@ -50,4 +52,4 @@ changelog:
filters:
exclude:
- "^docs:"
- "^test:"
- "_test:"