Nightly Run #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly Run | |
on: | |
schedule: | |
# daily at 23:00 UTC | |
- cron: "0 23 * * *" | |
workflow_dispatch: | |
permissions: read-all | |
jobs: | |
github-release: | |
runs-on: [self-hosted, public, linux, x64] | |
environment: release | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_PAT_SECRET }} | |
- name: Prepare Release | |
id: prepare_release | |
run: | | |
# grab latest release and tag to compare and decide to create a new one | |
create_release=true | |
latest_gh_release=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")') | |
latest_tag=$(git describe --abbrev=0 --tags) | |
if [ "$latest_gh_release" = "$latest_tag" ] | |
then | |
create_release=false | |
fi | |
echo "create_release=$create_release" >> $GITHUB_OUTPUT | |
echo "latest_release_version=$latest_gh_release" >> $GITHUB_OUTPUT | |
echo "version=$latest_tag" >> $GITHUB_OUTPUT | |
- name: Build GitHub Release changelog | |
if: steps.prepare_release.outputs.create_release == 'true' | |
id: build_github_release | |
uses: mikepenz/release-changelog-builder-action@3a70419f3cc01ac7458a4fa44f09726475edfc6a # v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT_SECRET }} | |
with: | |
configuration: ".github/release-changelog-config.json" | |
fromTag: ${{ steps.prepare_release.outputs.latest_release_version }} | |
toTag: ${{ steps.prepare_release.outputs.version }} | |
- name: Create GitHub Release | |
if: steps.build_github_release.outputs.changelog != '' | |
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v1 | |
with: | |
tag_name: ${{ steps.prepare_release.outputs.version }} | |
name: ${{ steps.prepare_release.outputs.version }} | |
body: ${{ steps.build_github_release.outputs.changelog }} | |
- name: Update CHANGELOG.md | |
if: steps.build_github_release.outputs.changelog != '' | |
uses: stefanzweifel/changelog-updater-action@bbfa2bd8afcc53bf7ec1f01e69a7847d82a8b4c6 # v1 | |
with: | |
latest-version: ${{ steps.prepare_release.outputs.version }} | |
release-notes: ${{ steps.build_github_release.outputs.changelog }} | |
- name: Commit updated CHANGELOG.md | |
if: steps.build_github_release.outputs.changelog != '' | |
uses: stefanzweifel/git-auto-commit-action@0b007fbd1180b8e3a3668b21c6517392fe8f26eb # v4 | |
with: | |
commit_message: "chore: update release notes" | |
file_pattern: CHANGELOG.md |