You've already forked helm-docker
fix(ci): add autoreleaser
This commit is contained in:
71
.gitea/workflows/auto-release.yaml
Normal file
71
.gitea/workflows/auto-release.yaml
Normal file
@@ -0,0 +1,71 @@
|
||||
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 HELM_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 '^[+-]HELM_VERSION'; then
|
||||
echo "HELM_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 HELM_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 'HELM_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
|
||||
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
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user