34 lines
1.1 KiB
YAML
34 lines
1.1 KiB
YAML
name: Container release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Log into local registry
|
|
run: echo "${{ secrets.FORGEJO_PAT }}" | docker login git.elijahkuntz.com -u "${{ github.actor }}" --password-stdin
|
|
- name: Build and publish immutable release
|
|
env:
|
|
REPOSITORY: ${{ github.repository }}
|
|
REVISION: ${{ github.sha }}
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
IMAGE_PATH="git.elijahkuntz.com/$(echo "$REPOSITORY" | tr '[:upper:]' '[:lower:]')"
|
|
docker build \
|
|
--build-arg VERSION="$TAG+$REVISION" \
|
|
--label org.opencontainers.image.revision="$REVISION" \
|
|
--label org.opencontainers.image.version="$TAG" \
|
|
-t "$IMAGE_PATH:$TAG" \
|
|
-t "$IMAGE_PATH:sha-$REVISION" \
|
|
-t "$IMAGE_PATH:latest" .
|
|
docker push "$IMAGE_PATH:$TAG"
|
|
docker push "$IMAGE_PATH:sha-$REVISION"
|
|
docker push "$IMAGE_PATH:latest"
|