martin-helmich/prometheus-nginxlog-exporter

View on GitHub
.github/workflows/release.yml

Summary

Maintainability
Test Coverage
name: Release

on:
  push:
    tags:
      - '*'

jobs:
  goreleaser:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        
      - name: Unshallow
        run: git fetch --prune --unshallow

      - name: Set up Go
        uses: actions/setup-go@v4
        with:
          go-version: 1.18.x
          
      - name: Set up QEMU
        uses: docker/setup-qemu-action@master
        with:
          platforms: all

      - name: Docker login
        if: success() && startsWith(github.ref, 'refs/tags/')
        env:
          DOCKER_USERNAME: ${{ secrets.dockerUsername }}
          DOCKER_PASSWORD: ${{ secrets.dockerPassword }}
          GITHUB_TOKEN: ${{ secrets.githubToken }}
        run: |
          echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin quay.io
          echo "${GITHUB_TOKEN}" | docker login docker.pkg.github.com -u helmich-bot --password-stdin

      - name: Set current date
        id: set_date
        run: |
          echo "BUILD_DATE=$(date)" >> $GITHUB_ENV

      - name: Export signing key
        run: 'echo "${{ secrets.PKG_SIGNING_KEY }}" > /tmp/signing-key'
          
      - name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v5
        with:
          version: v1.11.5
          args: release --rm-dist
        env:
          BUILD_USER: ${{ github.actor }} (via Github Actions)
          GITHUB_TOKEN: ${{ secrets.githubToken }}