forked from hm-edu/acme-dns
-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (48 loc) · 1.64 KB
/
Copy pathmonthly-patch-release.yml
File metadata and controls
55 lines (48 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Monthly Patch Release
on:
schedule:
# Runs on the first day of each month at 00:00 UTC
- cron: '0 0 1 * *'
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
patch-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
token: ${{ secrets.PRIVATE_PAT_TOKEN }}
fetch-depth: 0
- name: Get latest tag
id: latest-tag
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
echo "Latest tag: ${LATEST_TAG}"
- name: Increment patch version
id: new-version
run: |
LATEST_TAG=${{ steps.latest-tag.outputs.tag }}
# Remove 'v' prefix if present
VERSION="${LATEST_TAG#v}"
# Split version into parts
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
# Increment patch version
PATCH=$((PATCH + 1))
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
NEW_TAG="v${NEW_VERSION}"
echo "new-tag=${NEW_TAG}" >> $GITHUB_OUTPUT
echo "New version: ${NEW_TAG}"
- name: Create and push tag
run: |
git config --local user.email "info@theiotstudio.com"
git config --local user.name "tis-service-user"
git tag -a "${{ steps.new-version.outputs.new-tag }}" -m "Automated monthly patch release: ${{ steps.new-version.outputs.new-tag }}"
- name: Push changes
uses: ad-m/github-push-action@v1
with:
github_token: ${{ secrets.PRIVATE_PAT_TOKEN }}
tags: true