Skip to content

Create Release and Publish #3

Create Release and Publish

Create Release and Publish #3

Workflow file for this run

name: Create Release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
outputs:
version: ${{ steps.changelog.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Extract version and notes from CHANGELOG
id: changelog
run: |
# Extract version from first ## [x.x.x] header
VERSION=$(grep -m1 -oP '## \[\K[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md)
echo "version=$VERSION" >> $GITHUB_OUTPUT
# Extract release notes (content between first and second ## headers)
NOTES=$(awk '/^## \['"$VERSION"'\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md)
# Handle multiline output
{
echo "notes<<EOF"
echo "$NOTES"
echo "EOF"
} >> $GITHUB_OUTPUT
- name: Check if tag already exists
id: check_tag
run: |
if git rev-parse "v${{ steps.changelog.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Create Release
if: steps.check_tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.changelog.outputs.version }}
name: v${{ steps.changelog.outputs.version }}
body: ${{ steps.changelog.outputs.notes }}
draft: false
prerelease: false
- name: Skip release (tag exists)
if: steps.check_tag.outputs.exists == 'true'
run: |
echo "⚠️ Tag v${{ steps.changelog.outputs.version }} already exists. Skipping release creation."
exit 1
publish:

Check failure on line 62 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / Create Release

Invalid workflow file

The workflow is not valid. .github/workflows/release.yml (Line: 62, Col: 3): Error calling workflow 'sergioteula/python-amazon-paapi/.github/workflows/publish.yml@45e853d5cce09d575f21bb63ae770689ea256c53'. The nested job 'deploy' is requesting 'id-token: write', but is only allowed 'id-token: none'.
needs: release
uses: ./.github/workflows/publish.yml
with:
version: ${{ needs.release.outputs.version }}
secrets: inherit