|
| 1 | +name: "Dev Tag Pipeline" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + branch: |
| 7 | + description: The branch to create the dev tag on |
| 8 | + type: string |
| 9 | + required: true |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + setup: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + outputs: |
| 19 | + constantsVersion: ${{ steps.versions.outputs.constantsVersion }} |
| 20 | + constantsVersionXy: ${{ steps.versions.outputs.constantsVersionXy }} |
| 21 | + setupVersion: ${{ steps.versions.outputs.setupVersion }} |
| 22 | + setupVersionXy: ${{ steps.versions.outputs.setupVersionXy }} |
| 23 | + newestVersion: ${{ steps.versions.outputs.newestVersion }} |
| 24 | + targetBranch: ${{ steps.versions.outputs.targetBranch }} |
| 25 | + devTag: ${{ steps.versions.outputs.devTag }} |
| 26 | + releaseTag: ${{ steps.versions.outputs.releaseTag }} |
| 27 | + |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + ref: ${{ inputs.branch }} |
| 33 | + # Need a complete fetch to make the master merge check work |
| 34 | + fetch-depth: 0 |
| 35 | + fetch-tags: true |
| 36 | + token: ${{ secrets.ALL_REPO_PAT }} |
| 37 | + |
| 38 | + |
| 39 | + - name: Setup git |
| 40 | + run: | |
| 41 | + # NOTE: The user email is {user.id}+{user.login}@users.noreply.github.com. |
| 42 | + # See users API: https://api.github.com/users/github-actions%5Bbot%5D |
| 43 | + git config user.name "github-actions[bot]" |
| 44 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 45 | +
|
| 46 | + git fetch origin master |
| 47 | + - name: Check if branch needs master merge |
| 48 | + run: | |
| 49 | + if [[ $(git log origin/master ^HEAD) != "" ]]; then |
| 50 | + echo "You need to merge master into this branch." |
| 51 | + exit 1 |
| 52 | + fi |
| 53 | +
|
| 54 | + - name: Populate variables |
| 55 | + id: versions |
| 56 | + run: | |
| 57 | + . ./hooks/populate-hook-constants.sh |
| 58 | +
|
| 59 | + echo "constantsVersion=$constantsVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 60 | + echo "constantsVersionXy=$constantsVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 61 | + echo "setupVersion=$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 62 | + echo "setupVersionXy=$setupVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 63 | + echo "newestVersion=$newestVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 64 | + echo "targetBranch=$targetBranch" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 65 | +
|
| 66 | + echo "devTag=dev-v$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 67 | + echo "releaseTag=v$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 68 | +
|
| 69 | + - name: Check tag and branch correctness |
| 70 | + run: | |
| 71 | + if [[ "${{ steps.versions.outputs.setupVersion }}" != ${{ inputs.branch }}* ]] |
| 72 | + then |
| 73 | + echo "Adding tag to wrong branch" |
| 74 | + exit 1 |
| 75 | + fi |
| 76 | +
|
| 77 | + if git rev-parse ${{ steps.versions.outputs.releaseTag }} >/dev/null 2>&1 |
| 78 | + then |
| 79 | + echo "The released version of this tag already exists." |
| 80 | + exit 1 |
| 81 | + fi |
| 82 | +
|
| 83 | + - name: Delete tag if already tagged |
| 84 | + run: | |
| 85 | + git tag --delete ${{ steps.versions.outputs.devTag }} || true |
| 86 | + git push --delete origin ${{ steps.versions.outputs.devTag }} || true |
| 87 | +
|
| 88 | + - name: Install dependencies |
| 89 | + run: make dev-install |
| 90 | + |
| 91 | + - name: Build docs |
| 92 | + run: make build-docs |
| 93 | + |
| 94 | + - name: Commit doc changes |
| 95 | + run: | |
| 96 | + git add --all |
| 97 | + git commit --allow-empty -nm "doc: update docs for ${{ steps.versions.outputs.releaseTag }} tag" |
| 98 | + git push |
| 99 | +
|
| 100 | + - name: Create and push tag |
| 101 | + run: | |
| 102 | + # NOTE: The user email is {user.id}+{user.login}@users.noreply.github.com. |
| 103 | + # See users API: https://api.github.com/users/github-actions%5Bbot%5D |
| 104 | + git config user.name "github-actions[bot]" |
| 105 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 106 | +
|
| 107 | + git tag ${{ steps.versions.outputs.devTag }} |
| 108 | + git push --tags --follow-tags |
| 109 | +
|
| 110 | + mark-dev-tag-as-not-passed: |
| 111 | + runs-on: ubuntu-latest |
| 112 | + needs: |
| 113 | + - setup |
| 114 | + |
| 115 | + steps: |
| 116 | + - uses: actions/checkout@v4 |
| 117 | + with: |
| 118 | + ref: ${{ needs.setup.outputs.devTag }} |
| 119 | + fetch-tags: true |
| 120 | + |
| 121 | + - id: versions |
| 122 | + uses: supertokens/get-supported-versions-action@main |
| 123 | + with: |
| 124 | + has-cdi: true |
| 125 | + has-fdi: true |
| 126 | + |
| 127 | + - id: escape-versions |
| 128 | + run: | |
| 129 | + echo "fdiVersions=$(sed 's/"/\\"/g' <<< '${{ steps.versions.outputs.fdiVersions }}')" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 130 | + echo "cdiVersions=$(sed 's/"/\\"/g' <<< '${{ steps.versions.outputs.cdiVersions }}')" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" |
| 131 | +
|
| 132 | + - run: | |
| 133 | + ./hooks/populate-hook-constants.sh |
| 134 | +
|
| 135 | + curl --fail-with-body -X PUT \ |
| 136 | + https://api.supertokens.io/0/driver \ |
| 137 | + -H 'Content-Type: application/json' \ |
| 138 | + -H 'api-version: 0' \ |
| 139 | + -d "{ |
| 140 | + \"password\": \"${{ secrets.SUPERTOKENS_API_KEY }}\", |
| 141 | + \"version\":\"${{ needs.setup.outputs.setupVersion }}\", |
| 142 | + \"name\": \"python\", |
| 143 | + \"frontendDriverInterfaces\": ${{ steps.escape-versions.outputs.fdiVersions }}, |
| 144 | + \"coreDriverInterfaces\": ${{ steps.escape-versions.outputs.cdiVersions }} |
| 145 | + }" |
0 commit comments