Auto Release #41
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: Auto Release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'permify/**' | |
| - 'test/**' | |
| - 'docs/**' | |
| - 'requirements.txt' | |
| - 'setup.py' | |
| - 'pyproject.toml' | |
| - 'generator/openapi.json' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create tag and release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| run: | | |
| # Extract version from OpenAPI spec | |
| openapi_version=$(grep '"version":' generator/openapi.json | sed 's/.*"version": *"\([^"]*\)".*/\1/') | |
| if [ -n "$openapi_version" ]; then | |
| echo "Creating release $openapi_version" | |
| git config --global user.name 'GitHub Actions Bot' | |
| git config --global user.email '<>' | |
| git tag -a "$openapi_version" -m "Release $openapi_version" | |
| git push origin "$openapi_version" | |
| # Create GitHub release | |
| gh release create "$openapi_version" \ | |
| --repo="$GITHUB_REPOSITORY" \ | |
| --title="$openapi_version" \ | |
| --generate-notes | |
| else | |
| echo "Could not extract version from OpenAPI specification. Skipping release." | |
| exit 1 | |
| fi |