Skip to content

Release & Publish

Release & Publish #203

Workflow file for this run

name: Release & Publish
on:
create:
tags:
- v*
jobs:
release:
name: "Release binary"
runs-on: ubuntu-latest
steps:
- name: "Check out code"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Set up Go"
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: "Create release on GitHub"
uses: goreleaser/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
args: "release --clean"
version: latest
publish:
name: "Publish to GHCR"
runs-on: ubuntu-latest
steps:
- name: "Check out code"
uses: actions/checkout@v3
- name: "Login to GitHub Container Registry"
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build Docker Images"
uses: docker/[email protected]
with:
push: false
build-args: "VERSION=${{ github.ref_name }}"
tags: "${{ github.repository }}:latest,${{ github.repository }}:${{ github.ref_name }}"
- name: "Slim Images (latest)"
uses: kitabisa/docker-slim-action@v1
with:
target: "${{ github.repository }}:latest"
overwrite: true
env:
DSLIM_HTTP_PROBE: false
- name: "Slim Images (versioing)"
uses: kitabisa/docker-slim-action@v1
with:
target: "${{ github.repository }}:${{ github.ref_name }}"
overwrite: true
env:
DSLIM_HTTP_PROBE: false
- name: "Re-tagging & Push Images"
run: |
docker tag ${{ github.repository }}:latest ghcr.io/${{ github.repository }}:latest
docker tag ${{ github.repository }}:${{ github.ref_name }} ghcr.io/${{ github.repository }}:${{ github.ref_name }}
docker push ghcr.io/${{ github.repository }} -a