Rolling release #10616
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: Rolling release | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "*/15 * * * *" | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: app-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ secrets.GH_APP_ID }} | |
| private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} | |
| - id: get-user-id | |
| name: Get GitHub app user ID | |
| run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: "${{ steps.app-token.outputs.token }}" | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.app-token.outputs.token }} | |
| path: client-python | |
| - name: Install python and dependencies | |
| run: | | |
| pipx install poetry || true | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: client-python/pyproject.toml | |
| - name: Fetch schema | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: goauthentik/authentik | |
| token: "${{ steps.app-token.outputs.token }}" | |
| ref: main | |
| path: authentik | |
| sparse-checkout: | | |
| schema.yml | |
| sparse-checkout-cone-mode: false | |
| - id: changes | |
| name: Check for changes | |
| working-directory: authentik | |
| run: | | |
| if git diff --exit-code -- schema.yml > /dev/null; then | |
| echo "schema_has_changes=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "schema_has_changes=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Publish to GitHub | |
| if: "${{ steps.changes.outputs.schema_has_changes == 'true' }}" | |
| working-directory: client-python | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| version="$(yq -r '.info.version' schema.yml)-$(date +%s)" | |
| make version="$version" | |
| git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' | |
| git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com' | |
| git add . | |
| git commit -F "diff.test" || exit 0 | |
| git tag v$version | |
| git push | |
| git push --tags | |
| truncate -s '<125000' diff.test | |
| gh release create v$version -F diff.test --prerelease | |
| - name: Build package | |
| if: "${{ steps.changes.outputs.schema_has_changes == 'true' }}" | |
| working-directory: client-python | |
| run: | | |
| poetry build | |
| - name: Publish to PyPi | |
| if: "${{ steps.changes.outputs.schema_has_changes == 'true' }}" | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: client-python/dist/ |