Patch Version #28
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
on: | |
schedule: | |
- cron: "0 0 * * *" # release patch version every day | |
workflow_dispatch: # allows manual triggering | |
inputs: | |
level: | |
description: 'Release a patch version on the release branch, `auto` follow the last version level.' | |
required: true | |
default: 'auto' | |
type: choice | |
options: | |
- 'auto' | |
- 'beta' | |
- 'rc' | |
- 'patch' | |
permissions: | |
contents: write | |
name: "Patch Version" | |
jobs: | |
release_level: | |
runs-on: ubuntu-latest | |
outputs: | |
level: ${{ steps.concrete_level.outputs.level }} | |
steps: | |
- name: Release branch check | |
if: startsWith(github.ref, 'refs/heads/release-') != true | |
run: | | |
echo "You should only run this workflow on the release branch." | |
exit 1 | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- run: | | |
new_commit=$(git log $(git describe --tags --abbrev=0)..HEAD --oneline | wc -l) | |
if [ $new_commit -eq 0 ]; then | |
echo "No new commits since last version" | |
exit 1 | |
fi | |
- id: auto_detect | |
if: ${{ github.event.inputs.level == 'auto' || github.event.inputs.level == '' }} | |
run: echo "level=$(git describe --tags --abbrev=0 | grep -o "rc\|beta")" >> $GITHUB_OUTPUT | |
- id: concrete_level | |
run: | | |
level=${{ steps.auto_detect.outputs.level }} | |
echo "level=${level:=${{inputs.level}}}" >> $GITHUB_OUTPUT | |
call-workflow-passing-data: | |
needs: release_level | |
uses: RibirX/rclog/.github/workflows/release-version.yml@main | |
with: | |
level: ${{ needs.release_level.outputs.level }} | |
ref: ${{ github.ref }} | |
merge_changelog: ${{ needs.release_level.outputs.level == 'patch' }} | |
toolchain: stable | |
secrets: | |
CRATE_RELEASE_TOKEN: ${{ secrets.CRATE_RELEASE_TOKEN }} | |
GITHUB_RELEASE_TOKEN: ${{ secrets.RIBIR_RELEASE }} |