Skip to content

Merge pull request #37 from lazyfrosch/renovate/actions-checkout-4.x #37

Merge pull request #37 from lazyfrosch/renovate/actions-checkout-4.x

Merge pull request #37 from lazyfrosch/renovate/actions-checkout-4.x #37

Workflow file for this run

name: goreleaser
on:
push:
tags:
- 'v*'
branches:
- main
jobs:
goreleaser:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Docker Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Run goreleaser in snapshot mode
if: success() && ! startsWith(github.ref, 'refs/tags/v')
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist --snapshot
- name: Re-tag and push the snapshot image
if: success() && ! startsWith(github.ref, 'refs/tags/v')
run: |
docker tag ghcr.io/lazyfrosch/dslmodem_exporter:latest ghcr.io/lazyfrosch/dslmodem_exporter:main
docker push ghcr.io/lazyfrosch/dslmodem_exporter:main
- name: Upload assets for snapshots
if: success() && ! startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: dslmodem_exporter
path: dist/*
- name: Run GoReleaser in release mode
if: success() && startsWith(github.ref, 'refs/tags/v')
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}