Update auto-release.yml #10
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: Auto Release on '#new-release' commit | ||
on: | ||
push: | ||
branches: | ||
- main | ||
permissions: | ||
contents: write | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Check commit message for '#new-release' | ||
id: check_message | ||
run: | | ||
if git log --format=%B -n 1 | grep -q '#new-release'; then | ||
latest_release=$(git describe --tags --abbrev=0) | ||
new_release=$(echo $latest_release | awk -F. '{$NF = $NF + 1;} 1' OFS=.) | ||
echo "Creating release $new_release" | ||
git tag -a $new_release -m "Release $new_release" | ||
git push origin $new_release | ||
echo "::set-output name=new_release::$new_release" | ||
else | ||
echo "Commit does not include '#new-release'. Skipping release." | ||
exit 0 | ||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
run: | | ||
Check failure on line 35 in .github/workflows/auto-release.yml GitHub Actions / Auto Release on '#new-release' commitInvalid workflow file
|
||
gh release create "${{ steps.check_message.outputs.new_release }}" \ | ||
--repo="$GITHUB_REPOSITORY" \ | ||
--title="${{ steps.check_message.outputs.new_release#v }}" \ | ||
--generate-notes |