|
| 1 | +name: Monthly Release |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run on the 1st of every month at 00:00 UTC |
| 6 | + - cron: '0 0 1 * *' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + release: |
| 14 | + name: Create monthly snapshot release |
| 15 | + runs-on: ubuntu-24.04 |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Generate release tag |
| 24 | + id: tag |
| 25 | + run: | |
| 26 | + TAG="v$(date +'%Y.%m')" |
| 27 | + echo "tag=${TAG}" >> $GITHUB_OUTPUT |
| 28 | + echo "Release tag: ${TAG}" |
| 29 | +
|
| 30 | + - name: Generate release notes |
| 31 | + id: notes |
| 32 | + run: | |
| 33 | + TAG="${{ steps.tag.outputs.tag }}" |
| 34 | + PREVIOUS_TAG=$(git tag --sort=-version:refname | head -n1) |
| 35 | + |
| 36 | + if [ -z "$PREVIOUS_TAG" ]; then |
| 37 | + echo "First release - no previous tag found" |
| 38 | + NOTES="Monthly snapshot release ${TAG} |
| 39 | +
|
| 40 | +This is an automated monthly snapshot of bluefin-common configuration files." |
| 41 | + else |
| 42 | + echo "Generating notes since ${PREVIOUS_TAG}" |
| 43 | + NOTES="Monthly snapshot release ${TAG} |
| 44 | + |
| 45 | +## Changes since ${PREVIOUS_TAG} |
| 46 | + |
| 47 | +$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:'- %s (%h)' --no-merges) |
| 48 | + |
| 49 | +--- |
| 50 | +*This is an automated monthly snapshot of bluefin-common configuration files.*" |
| 51 | + fi |
| 52 | + |
| 53 | + echo "notes<<EOF" >> $GITHUB_OUTPUT |
| 54 | + echo "$NOTES" >> $GITHUB_OUTPUT |
| 55 | + echo "EOF" >> $GITHUB_OUTPUT |
| 56 | + |
| 57 | + - name: Create Release |
| 58 | + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 |
| 59 | + with: |
| 60 | + tag: ${{ steps.tag.outputs.tag }} |
| 61 | + name: ${{ steps.tag.outputs.tag }} |
| 62 | + body: ${{ steps.notes.outputs.notes }} |
| 63 | + draft: false |
| 64 | + prerelease: false |
| 65 | + makeLatest: true |
0 commit comments