Dev Tag Pipeline #7
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: "Dev Tag Pipeline" | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: The branch to create the dev tag on | |
type: string | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
constantsVersion: ${{ steps.versions.outputs.constantsVersion }} | |
constantsVersionXy: ${{ steps.versions.outputs.constantsVersionXy }} | |
setupVersion: ${{ steps.versions.outputs.setupVersion }} | |
setupVersionXy: ${{ steps.versions.outputs.setupVersionXy }} | |
newestVersion: ${{ steps.versions.outputs.newestVersion }} | |
targetBranch: ${{ steps.versions.outputs.targetBranch }} | |
devTag: ${{ steps.versions.outputs.devTag }} | |
releaseTag: ${{ steps.versions.outputs.releaseTag }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch }} | |
# Need a complete fetch to make the master merge check work | |
fetch-depth: 0 | |
fetch-tags: true | |
token: ${{ secrets.ALL_REPO_PAT }} | |
- name: Setup git | |
run: | | |
# NOTE: The user email is {user.id}+{user.login}@users.noreply.github.com. | |
# See users API: https://api.github.com/users/github-actions%5Bbot%5D | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git fetch origin master | |
- name: Check if branch needs master merge | |
run: | | |
if [[ $(git log origin/master ^HEAD) != "" ]]; then | |
echo "You need to merge master into this branch." | |
exit 1 | |
fi | |
- name: Populate variables | |
id: versions | |
run: | | |
. ./hooks/populate-hook-constants.sh | |
echo "constantsVersion=$constantsVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
echo "constantsVersionXy=$constantsVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
echo "setupVersion=$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
echo "setupVersionXy=$setupVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
echo "newestVersion=$newestVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
echo "targetBranch=$targetBranch" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
echo "devTag=dev-v$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
echo "releaseTag=v$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
- name: Check tag and branch correctness | |
run: | | |
if [[ "${{ steps.versions.outputs.setupVersion }}" != ${{ inputs.branch }}* ]] | |
then | |
echo "Adding tag to wrong branch" | |
exit 1 | |
fi | |
if git rev-parse ${{ steps.versions.outputs.releaseTag }} >/dev/null 2>&1 | |
then | |
echo "The released version of this tag already exists." | |
exit 1 | |
fi | |
- name: Delete tag if already tagged | |
run: | | |
git tag --delete ${{ steps.versions.outputs.devTag }} || true | |
git push --delete origin ${{ steps.versions.outputs.devTag }} || true | |
- name: Install dependencies | |
run: make dev-install | |
- name: Build docs | |
run: make build-docs | |
- name: Commit doc changes | |
run: | | |
git add --all | |
git commit --allow-empty -nm "doc: update docs for ${{ steps.versions.outputs.releaseTag }} tag" | |
git push | |
- name: Create and push tag | |
run: | | |
# NOTE: The user email is {user.id}+{user.login}@users.noreply.github.com. | |
# See users API: https://api.github.com/users/github-actions%5Bbot%5D | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git tag ${{ steps.versions.outputs.devTag }} | |
git push --tags --follow-tags | |
mark-dev-tag-as-not-passed: | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.setup.outputs.devTag }} | |
fetch-tags: true | |
- id: versions | |
uses: supertokens/get-supported-versions-action@main | |
with: | |
has-cdi: true | |
has-fdi: true | |
- id: escape-versions | |
run: | | |
echo "fdiVersions=$(sed 's/"/\\"/g' <<< '${{ steps.versions.outputs.fdiVersions }}')" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
echo "cdiVersions=$(sed 's/"/\\"/g' <<< '${{ steps.versions.outputs.cdiVersions }}')" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" | |
- run: | | |
./hooks/populate-hook-constants.sh | |
curl --fail-with-body -X PUT \ | |
https://api.supertokens.io/0/driver \ | |
-H 'Content-Type: application/json' \ | |
-H 'api-version: 0' \ | |
-d "{ | |
\"password\": \"${{ secrets.SUPERTOKENS_API_KEY }}\", | |
\"version\":\"${{ needs.setup.outputs.setupVersion }}\", | |
\"name\": \"python\", | |
\"frontendDriverInterfaces\": ${{ steps.escape-versions.outputs.fdiVersions }}, | |
\"coreDriverInterfaces\": ${{ steps.escape-versions.outputs.cdiVersions }} | |
}" |