Skip to content

Commit

Permalink
chore: add calver release script
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Buhl <[email protected]>
  • Loading branch information
onedr0p committed Nov 6, 2023
1 parent 3f4bbb8 commit 70a3ced
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/link-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
broken-links
- name: Update Issue
uses: peter-evans/create-issue-from-file@433e51abf769039ee20ba1293a088ca19d573b7f # renovate: tag=v4.0.1
uses: peter-evans/create-issue-from-file@433e51abf769039ee20ba1293a088ca19d573b7f # v4.0.1
with:
title: Broken links detected 🔗
issue-number: "${{ steps.link-checker-issue.outputs.issue-number }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/meta-sync-labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Sync Labels
uses: EndBug/label-sync@da00f2c11fdb78e4fae44adac2fdd713778ea3e8 # renovate: tag=v2.3.2
uses: EndBug/label-sync@da00f2c11fdb78e4fae44adac2fdd713778ea3e8 # v2.3.2
with:
config-file: .github/labels.yaml
token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: "Release"

on:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *"

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Create Release
shell: bash
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
# Retrieve previous release tag
previous_tag="$(gh release list --limit 1 | awk '{ print $1 }')"
previous_major="${previous_tag%%\.*}"
previous_minor="${previous_tag#*.}"
previous_minor="${previous_minor%.*}"
previous_patch="${previous_tag##*.}"
# Determine next release tag
next_major_minor="$(date +'%Y').$(date +'%-m')"
if [[ "${previous_major}.${previous_minor}" == "${next_major_minor}" ]]; then
echo "Month release already exists for year, incrementing patch number by 1"
next_patch="$((previous_patch + 1))"
else
echo "Month release does not exist for year, setting patch number to 0"
next_patch="0"
fi
# Create release
release_tag="${next_major_minor}.${next_patch}"
gh release create "${release_tag}" \
--repo="${GITHUB_REPOSITORY}" \
--title="${release_tag}" \
--generate-notes

0 comments on commit 70a3ced

Please sign in to comment.