All checks were successful
Build container images / build (push) Successful in 1m52s
76 lines
2.3 KiB
YAML
76 lines
2.3 KiB
YAML
|
|
name: Build and publish container images
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
type: string
|
|
description: Semver to publish (e.g. "<major>.<minor>.<patch>")
|
|
required: true
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: gitea.jbrumond.me
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Parse Semver Tag String
|
|
id: semver
|
|
shell: bash
|
|
env:
|
|
version_str: ${{ inputs.version }}
|
|
run: |
|
|
if egrep '^[0-9]+\.[0-9]+\.[0-9]+$' <<<"$version_str" >/dev/null 2>&1 ; then
|
|
n=${version_str//[!0-9]/ }
|
|
a=(${n//\./ })
|
|
|
|
echo "major=${a[0]}" >> $GITHUB_OUTPUT
|
|
echo "minor=${a[1]}" >> $GITHUB_OUTPUT
|
|
echo "patch=${a[2]}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo 'Invalid semver version given'
|
|
exit 1
|
|
fi
|
|
|
|
- name: Build Container and publish
|
|
uses: docker/build-push-action@v4
|
|
env:
|
|
# see <https://docs.gitea.com/usage/actions/comparison#dockerbuild-push-actionv4>
|
|
ACTIONS_RUNTIME_TOKEN: ''
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
gitea.jbrumond.me/doc-utils/utils:latest
|
|
gitea.jbrumond.me/doc-utils/utils:${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}.${{ steps.semver.outputs.patch }}
|
|
gitea.jbrumond.me/doc-utils/utils:${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}
|
|
gitea.jbrumond.me/doc-utils/utils:${{ steps.semver.outputs.major }}
|
|
platforms: |
|
|
linux/amd64
|
|
linux/arm64
|
|
# linux/riscv64
|
|
# linux/arm/v7
|
|
# linux/arm/v6
|
|
build-args: |
|
|
NODE_VERSION=22
|
|
secrets: |
|
|
"npmrc=@doc-utils:registry=https://gitea.jbrumond.me/api/packages/doc-utils/npm/
|
|
//gitea.jbrumond.me/api/packages/doc-utils/npm/:_authToken=${{ secrets.NPM_TOKEN }}"
|