Skip to content

Monthly Patching

Monthly Patching #8

name: Monthly Patching
on:
schedule:
# Runs at 00:00 on the first day of every month
- cron: '30 6 29 * *'
jobs:
tag:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{secrets.GHCR_TOKEN}}
- name: Set up Git
run: |
git config --global user.name "eipmgithubsvc1"
git config --global user.email "[email protected]"
- name: Get the latest release
id: latest-release
uses: actions/github-script@v7
with:
script: |
const release = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
});
return release.data.tag_name;
- name: Generate new tag
run: |
ORIGINAL_TAG=${{ steps.latest-release.outputs.result }}
if [[ $ORIGINAL_TAG == *".patched"* ]]; then
BASE_TAG=${ORIGINAL_TAG%%.patched*}
else
BASE_TAG=$ORIGINAL_TAG
fi
DATE=$(date +'%Y%m%d')
echo "NEW_TAG=$BASE_TAG.patched$DATE" >> $GITHUB_ENV
- name: Create and push tag
run: |
git tag $NEW_TAG
git push origin $NEW_TAG