fix(ci): implement autoreleaser
All checks were successful
Build / build-amd64 (push) Successful in 29s
Lint Markdown files / markdown-lint (push) Successful in 4s
Update Docker Hub Description / update-description-on-hub-docker-io (push) Successful in 4s
Build / build-arm64 (push) Successful in 1m12s

This commit is contained in:
2026-01-04 10:03:17 +01:00
parent 4bcfb8fb2d
commit fae7fb057d
4 changed files with 191 additions and 30 deletions

View File

@@ -0,0 +1,72 @@
name: Auto release
on:
push:
branches: [ "master" ]
paths:
- Makefile
env:
GIT_EMAIL: noreply@cryptic.systems
GIT_USER: CSRBot
jobs:
tag_on_change:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5.0.0
with:
fetch-depth: 0
- name: Check if MARKDOWNLINT_VERSION line changed
id: check_change
run: |
echo "changed=false" >> $GITHUB_OUTPUT
for file in Makefile; do
if git diff HEAD~1 HEAD -- "${file}" | grep --quiet '^[+-]MARKDOWNLINT_VERSION'; then
echo "MARKDOWNLINT_VERSION line changed."
echo "changed=true" >> $GITHUB_OUTPUT
break
fi
done
- name: Stop if no change detected
if: steps.check_change.outputs.changed == 'false'
run: echo "No MARKDOWNLINT_VERSION change. Exiting..."
- name: Create and push new tag
id: create_tag
if: steps.check_change.outputs.changed == 'true'
run: |
defined_tag="$(grep --only-matching --perl-regexp 'MARKDOWNLINT_VERSION\?=v?[\d]*(\.[\d]*){0,2}' Makefile | cut --delimiter='=' --fields=2)"
echo "defined_tag=${defined_tag}" >> $GITHUB_OUTPUT
echo "New tag: ${defined_tag}"
git config --local user.name "${GIT_USER}"
git config --local user.email "${GIT_EMAIL}"
git tag -a "${defined_tag}" -m "${defined_tag}"
git push origin "${defined_tag}"
- name: Trigger "Push tagged images" workflow
if: steps.check_change.outputs.changed == 'true'
uses: actions/github-script@v8.0.0
with:
script: |
const workflowFileName = 'release.yaml';
const defaultBranch = context.payload.repository.default_branch;
const definedTag = '${{ steps.create_tag.outputs.defined_tag }}';
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowFileName,
ref: defaultBranch,
inputs: {
tag: definedTag
}
});

View File

@@ -4,12 +4,34 @@ on:
push:
tags:
- "**"
workflow_dispatch:
inputs:
tag:
description: "Tag which should be released"
type: string
required: true
jobs:
push-arm64:
runs-on: ubuntu-latest-arm64
steps:
- id: version_extraction
name: Extract git tag
run: |
VERSION="${{ inputs.tag || github.ref_name }}"
VERSION="${VERSION#refs/*/}"
echo "Version (raw): ${VERSION}"
echo "Version (cleaned): ${VERSION/v/}"
echo "version_raw=${VERSION}" >> $GITHUB_OUTPUT
echo "version_cleaned=${VERSION/v/}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v6.0.1
with:
fetch-tags: true
ref: "${{ steps.version_extraction.outputs.version_raw }}"
- uses: docker/setup-qemu-action@v3.7.0
- uses: docker/setup-buildx-action@v3.12.0
@@ -21,21 +43,35 @@ jobs:
- name: Build and push image
run: |
TAG=$(echo ${{ github.ref_name }} | sed 's/v//gm')
docker buildx build \
--build-arg MARKDOWNLINT_VERSION=${{ github.ref_name }} \
--build-arg MARKDOWNLINT_VERSION=${{ steps.version_extraction.outputs.version_raw }} \
--file Dockerfile \
--platform linux/arm64 \
--provenance false \
--push \
--tag git.cryptic.systems/volker.raschek/markdownlint:${TAG}-arm64 \
--tag git.cryptic.systems/volker.raschek/markdownlint:${{ steps.version_extraction.outputs.version_cleaned }}-arm64 \
.
push-amd64:
runs-on: ubuntu-latest-amd64
steps:
- id: version_extraction
name: Extract git tag
run: |
VERSION="${{ inputs.tag || github.ref_name }}"
VERSION="${VERSION#refs/*/}"
echo "Version (raw): ${VERSION}"
echo "Version (cleaned): ${VERSION/v/}"
echo "version_raw=${VERSION}" >> $GITHUB_OUTPUT
echo "version_cleaned=${VERSION/v/}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v6.0.1
with:
fetch-tags: true
ref: "${{ steps.version_extraction.outputs.version_raw }}"
- uses: docker/setup-qemu-action@v3.7.0
- uses: docker/setup-buildx-action@v3.12.0
@@ -47,15 +83,13 @@ jobs:
- name: Build and push image
run: |
TAG=$(echo ${{ github.ref_name }} | sed 's/v//gm')
docker buildx build \
--build-arg MARKDOWNLINT_VERSION=${{ github.ref_name }} \
--build-arg MARKDOWNLINT_VERSION=${{ steps.version_extraction.outputs.version_raw }} \
--file Dockerfile \
--platform linux/amd64 \
--provenance false \
--push \
--tag git.cryptic.systems/volker.raschek/markdownlint:${TAG}-amd64 \
--tag git.cryptic.systems/volker.raschek/markdownlint:${{ steps.version_extraction.outputs.version_cleaned }}-amd64 \
.
push-manifest:
@@ -64,6 +98,18 @@ jobs:
- push-arm64
- push-amd64
steps:
- id: version_extraction
name: Extract git tag
run: |
VERSION="${{ inputs.tag || github.ref_name }}"
VERSION="${VERSION#refs/*/}"
echo "Version (raw): ${VERSION}"
echo "Version (cleaned): ${VERSION/v/}"
echo "version_raw=${VERSION}" >> $GITHUB_OUTPUT
echo "version_cleaned=${VERSION/v/}" >> $GITHUB_OUTPUT
- uses: docker/login-action@v3.6.0
with:
registry: git.cryptic.systems
@@ -72,30 +118,38 @@ jobs:
- name: Create and push manifest
run: |
TAG=$(echo ${{ github.ref_name }} | sed 's/v//gm')
docker manifest create git.cryptic.systems/volker.raschek/markdownlint:${{ steps.version_extraction.outputs.version_cleaned }} \
--amend git.cryptic.systems/volker.raschek/markdownlint:${{ steps.version_extraction.outputs.version_cleaned }}-amd64 \
--amend git.cryptic.systems/volker.raschek/markdownlint:${{ steps.version_extraction.outputs.version_cleaned }}-arm64
docker manifest create git.cryptic.systems/volker.raschek/markdownlint:${TAG} \
--amend git.cryptic.systems/volker.raschek/markdownlint:${TAG}-amd64 \
--amend git.cryptic.systems/volker.raschek/markdownlint:${TAG}-arm64
docker manifest push git.cryptic.systems/volker.raschek/markdownlint:${TAG}
docker manifest push git.cryptic.systems/volker.raschek/markdownlint:${{ steps.version_extraction.outputs.version_cleaned }}
sync-to-hub-docker-io:
needs:
- push-manifest
runs-on: ubuntu-latest
steps:
- name: Copy images to docker.io
run: |
TAG=$(echo ${{ github.ref_name }} | sed 's/v//gm')
- id: version_extraction
name: Extract git tag
run: |
VERSION="${{ inputs.tag || github.ref_name }}"
VERSION="${VERSION#refs/*/}"
apt-get update --yes
apt-get install --yes skopeo
skopeo copy \
--all \
--dest-password ${{ secrets.DOCKER_IO_PASSWORD }} \
--dest-username ${{ secrets.DOCKER_IO_USERNAME }} \
--src-password ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }} \
--src-username volker.raschek \
docker://git.cryptic.systems/volker.raschek/markdownlint:${TAG} \
docker://docker.io/volkerraschek/markdownlint:${TAG}
echo "Version (raw): ${VERSION}"
echo "Version (cleaned): ${VERSION/v/}"
echo "version_raw=${VERSION}" >> $GITHUB_OUTPUT
echo "version_cleaned=${VERSION/v/}" >> $GITHUB_OUTPUT
- name: Copy images to docker.io
run: |
apt-get update --yes
apt-get install --yes skopeo
skopeo copy \
--all \
--dest-password ${{ secrets.DOCKER_IO_PASSWORD }} \
--dest-username ${{ secrets.DOCKER_IO_USERNAME }} \
--src-password ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }} \
--src-username volker.raschek \
docker://git.cryptic.systems/volker.raschek/markdownlint:${{ steps.version_extraction.outputs.version_cleaned }} \
docker://docker.io/volkerraschek/markdownlint:${{ steps.version_extraction.outputs.version_cleaned }}

View File

@@ -8,3 +8,13 @@ binary can be found in the upstream project of [igorshubovych](https://github.co
The workflow or how `markdownlint-ci` can be used is pretty good
[documented](https://github.com/igorshubovych/markdownlint-cli#usage).
```bash
IMAGE_VERSION=0.45.0
docker run \
--rm \
--volume "$(pwd):$(pwd)" \
--workdir "$(pwd)" \
"git.cryptic.systems/volker.raschek/markdownlint:${IMAGE_VERSION}" \
--help
```

View File

@@ -1,5 +1,19 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"customManagers": [
{
"customType": "regex",
"fileMatch": [
"^README\\.md$"
],
"matchStrings": [
"IMAGE_VERSION=(?<currentValue>.*)"
],
"datasourceTemplate": "github-releases",
"depNameTemplate": "igorshubovych/markdownlint-cli",
"versioningTemplate": "semver"
}
],
"extends": [
"local>volker.raschek/renovate-config:default#master",
"local>volker.raschek/renovate-config:container#master",
@@ -8,9 +22,20 @@
],
"packageRules": [
{
"automerge": false,
"matchPackageNames": [ "markdownlint-cli" ],
"matchManagers": [ "regex" ]
"addLabels": [
"renovate/automerge"
],
"automerge": true,
"matchPackageNames": [
"igorshubovych/markdownlint-cli"
],
"matchManagers": [
"regex"
],
"matchUpdateTypes": [
"minor",
"patch"
]
}
]
}