Skip to content

Release Docker images om GHCR #1

Release Docker images om GHCR

Release Docker images om GHCR #1

Workflow file for this run

name: ci
on:
push:
branches:
- main
release:
pull_request: #dev only, remove me!!!
jobs:
build-test:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install just
uses: taiki-e/install-action@just
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Create Kind Cluster
uses: helm/kind-action@v1
with:
cluster_name: kind
- name: Install ko
uses: ko-build/[email protected]
env:
KO_DOCKER_REPO: kind.local
- name: Install dependencies
run: |
go mod download
- name: Run a ko build
run: just build
env:
KO_DOCKER_REPO: ghcr.io/cofide/cofidectl-debug-container
- name: Tag the image with the release tag
if: github.event_name == 'release'
run: |
docker tag ghcr.io/cofide/cofidectl-debug-container:latest ghcr.io/cofide/cofidectl-debug-container:${GITHUB_REF#refs/tags/}
- name: Tag the image with the commit hash
if: github.event_name != 'release'
run: |
docker tag ghcr.io/cofide/cofidectl-debug-container:latest ghcr.io/cofide/cofidectl-debug-container:${GITHUB_SHA}
- name: Login to GitHub Container Registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u cofide --password-stdin
- name: Push the release tag
if: github.event_name == 'release'
run: |
docker push ghcr.io/cofide/cofidectl-debug-container:${GITHUB_REF#refs/tags/}
- name: Push the commit hash
if: github.event_name == 'release'
run: |
docker push ghcr.io/cofide/cofidectl-debug-container:${GITHUB_SHA}