hugo-theme-relearn/.github/actions/release_milestone/action.yaml

173 lines
5.4 KiB
YAML
Raw Normal View History

2021-10-23 09:56:11 +00:00
name: Release milestone
description: Creates a release and tag out of a given milestone
2021-10-23 09:56:11 +00:00
inputs:
milestone:
description: Milestone for this release
required: true
github_token:
description: Secret GitHub token
required: true
runs:
using: composite
steps:
- name: Setup node
uses: actions/setup-node@v4
2021-10-23 09:56:11 +00:00
with:
node-version: '16'
- name: Setup git
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Get current date
id: date
uses: Kaven-Universe/github-action-current-date-time@v1
with:
format: 'YYYY-MM-DD'
2024-09-14 23:23:35 +00:00
- name: Get current major version number
id: majorvers
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
2024-09-14 23:23:35 +00:00
regex: (\d+)\.\d+\.\d+
2023-01-30 11:57:11 +00:00
replacement: "$1"
2024-09-14 23:23:35 +00:00
- name: Get current main version number
id: mainvers
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
regex: (\d+)\.(\d+)\.\d+
2024-09-14 23:23:35 +00:00
replacement: "$1.$2"
2024-09-14 23:23:35 +00:00
- name: Get current main version number for anchoring
id: mainanchor
2023-01-30 11:57:11 +00:00
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
2024-09-14 23:23:35 +00:00
regex: (\d+)\.(\d+)\.\d+
replacement: "$1$2"
- name: Get next version number
id: nextvers
uses: WyriHaximus/github-action-next-semvers@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
version: ${{ env.MILESTONE }}
2021-10-23 09:56:11 +00:00
- name: Close milestone
2023-05-27 22:16:26 +00:00
uses: Akkjon/close-milestone@v2.1.0
continue-on-error: true
2021-10-23 09:56:11 +00:00
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
with:
milestone_name: ${{ env.MILESTONE }}
2021-10-23 09:56:11 +00:00
- name: Create temporary tag
2021-10-23 09:56:11 +00:00
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
2023-01-30 11:57:11 +00:00
git tag --message "" "$MILESTONE" || true
git push origin "$MILESTONE" || true
git tag --force --message "" "$MILESTONE"
git push --force origin "$MILESTONE"
2021-10-23 09:56:11 +00:00
2024-09-14 23:23:35 +00:00
- name: Update releasenotes
uses: mingjun97/file-regex-replace@v1
with:
2024-09-14 23:23:35 +00:00
regex: '(.)[\n\r\s]*<!--GH-ACTION-RELEASE-MILESTONE-->[\n\r\s]*[\n\r]+##\s*.*?[\n\r][\n\r\s]*(.)'
replacement: "$1\n\n<!--GH-ACTION-RELEASE-MILESTONE-->\n\n## ${{ steps.mainvers.outputs.value }}.0 (${{ steps.date.outputs.time }}) {#${{ steps.mainanchor.outputs.value }}0}\n\n$2"
include: exampleSite/content/basics/releasenotes/${{ steps.majorvers.outputs.value }}.x/_index.en.md
- name: Update generator version
2021-10-23 09:56:11 +00:00
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
run: |
echo -n "$MILESTONE" > layouts/partials/version.txt
- name: Update changelog
shell: bash
env:
2021-10-23 09:56:11 +00:00
GITHUB_TOKEN: ${{ inputs.github_token }}
GREN_GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
npx github-release-notes@0.17.1 changelog --generate --override --tags=all
- name: Commit updates
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
GREN_GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
2021-10-23 09:56:11 +00:00
git add *
git commit --message "Ship tag $MILESTONE"
git push origin main
- name: Create final tag
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
2023-01-30 11:57:11 +00:00
MILESTONE_MINOR: ${{ steps.mainvers.outputs.value }}
MILESTONE_MAJOR: ${{ steps.majorvers.outputs.value }}
2021-10-23 09:56:11 +00:00
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
2023-01-30 11:57:11 +00:00
git tag --force --message "" "$MILESTONE"
2021-10-23 09:56:11 +00:00
git push --force origin "$MILESTONE"
2023-01-30 11:57:11 +00:00
git tag --message "" "$MILESTONE_MINOR.x" || true
git push origin "$MILESTONE_MINOR.x" || true
git tag --force --message "" "$MILESTONE_MINOR.x"
git push --force origin "$MILESTONE_MINOR.x"
git tag --message "" "$MILESTONE_MAJOR.x" || true
git push origin "$MILESTONE_MAJOR.x" || true
git tag --force --message "" "$MILESTONE_MAJOR.x"
git push --force origin "$MILESTONE_MAJOR.x"
git tag --message "" "x" || true
git push origin "x" || true
git tag --force --message "" "x"
git push --force origin "x"
2021-10-23 09:56:11 +00:00
- name: Publish release
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
GREN_GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
npx github-release-notes@0.17.1 release --tags "$MILESTONE"
- name: Update version number to mark non-release version
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
echo -n "$MILESTONE+tip" > layouts/partials/version.txt
git add *
2022-02-11 08:40:22 +00:00
git commit --message "Mark non-release version"
git push origin main
- name: Create next patch milestone
uses: WyriHaximus/github-action-create-milestone@v1
continue-on-error: true
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
with:
title: ${{ steps.nextvers.outputs.patch }}