Skip to content

ci: automate releases #9

ci: automate releases

ci: automate releases #9

Workflow file for this run

name: build-containers
on:
push:
branches:
- main
permissions:
contents: write
packages: write
jobs:
build-publish:
name: updown-exporter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- uses: go-semantic-release/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ko-build/[email protected]
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
git fetch --tags
descr=$(git describe --tags)
short=$(git describe --tags --abbrev=0)
export version="${descr#v}"
if [[ $descr == $short ]]; then
minor="${version#*.}"
major="${version%%.*}"
ko build --bare --sbom=none -t edge -t latest -t "$version" -t "$minor" -t "$major" .
else
ko build --bare --sbom=none -t edge .
fi
env:
KO_DOCKER_REPO: ghcr.io/${{ github.repository }}