You've already forked docker-compose-docker
Some checks failed
Auto release / tag_on_change (push) Successful in 9s
Build / build-amd64 (push) Has been cancelled
Build / build-arm64 (push) Has been cancelled
Lint Markdown files / markdown-lint (push) Has been cancelled
Update Docker Hub Description / update-description-on-hub-docker-io (push) Successful in 5s
80 lines
2.4 KiB
YAML
80 lines
2.4 KiB
YAML
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 DC_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 '^[+-]DC_VERSION'; then
|
|
echo "DC_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 DC_VERSION change. Exiting..."
|
|
|
|
- name: Get latest tag
|
|
if: steps.check_change.outputs.changed == 'true'
|
|
id: get_tag
|
|
run: |
|
|
latest_tag=$(git tag --sort=-v:refname | grep --extended-regexp '^v[0-9]+\.[0-9]+\.[0-9]+$' | head --lines 1 || echo "0.0.0")
|
|
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
|
|
echo "Latest tag: $latest_tag"
|
|
|
|
|
|
- name: Increment patch version
|
|
if: steps.check_change.outputs.changed == 'true'
|
|
id: bump
|
|
run: |
|
|
latest_tag=${{ steps.get_tag.outputs.latest_tag }}
|
|
IFS='.' read -r major minor patch <<< "$latest_tag"
|
|
patch=$((patch + 1))
|
|
new_tag="${major}.${minor}.${patch}"
|
|
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
|
|
echo "New tag: $new_tag"
|
|
|
|
- name: Create and push new tag
|
|
if: steps.check_change.outputs.changed == 'true'
|
|
run: |
|
|
new_tag=${{ steps.bump.outputs.new_tag }}
|
|
git config --local user.name "${GIT_USER}"
|
|
git config --local user.email "${GIT_EMAIL}"
|
|
git tag -a "${new_tag}" -m "${new_tag}"
|
|
git push origin "${new_tag}"
|
|
|
|
- name: Trigger "Push tagged images" workflow
|
|
if: steps.check_change.outputs.changed == 'true'
|
|
uses: peter-evans/repository-dispatch@v4.0.0
|
|
with:
|
|
client-payload: |
|
|
{
|
|
"tag": "${{ steps.bump.outputs.new_tag }}"
|
|
}
|
|
event-type: push-tagged-images
|
|
repository: ${{ github.repository }}
|
|
token: ${{ github.token }}
|