ci: add write permission #8
This file contains hidden or 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: Package and Release Tarot Deck | |
| permissions: | |
| contents: write | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Extract version and package deck | |
| id: package | |
| run: | | |
| VERSION=$(grep -E '^version\s*=\s*"[^"]+"' rider-waite-smith/deck.toml | sed -E 's/^version\s*=\s*"([^"]+)"/\1/') | |
| echo "Found version: $VERSION" | |
| PACKAGE_NAME="rider-waite-smith-${VERSION}" | |
| ZIP_FILE="${PACKAGE_NAME}.zip" | |
| echo "Creating package: $ZIP_FILE" | |
| zip -r "${ZIP_FILE}" rider-waite-smith | |
| ls -la "${ZIP_FILE}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "zip_file=$ZIP_FILE" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ steps.package.outputs.zip_file }} | |
| name: Rider-Waite-Smith Tarot Deck v${{ steps.package.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| body: | | |
| Rider-Waite-Smith Tarot Deck v${{ steps.package.outputs.version }} | |
| This release contains the packaged Rider-Waite-Smith tarot deck version ${{ steps.package.outputs.version }} according to the Tarot Deck Specification. | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |