chore(main): release 3.8.0 #101
Workflow file for this run
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: Deploy Production Environments | |
| # Amends the open release-please PR: copy `sha-*` image tags from staging (`*-s`, `*-us-s`) into | |
| # production yamls on whatever is currently on that branch, then disable staging indexers | |
| # when prod matches (always true after a verbatim promote). | |
| # | |
| # GitHub deployment environments are recorded in record-deployment-environments.yaml | |
| # when this lands on main — not when committing to the release-please branch. | |
| on: | |
| push: | |
| branches: | |
| - "release-please--**" | |
| concurrency: | |
| group: deploy-prod-release-please-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| promote-api-v3-main: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf | |
| with: | |
| app-id: ${{ secrets.DEPLOYMENT_APP_ID }} | |
| private-key: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }} | |
| - name: Checkout release-please branch | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| ref: ${{ github.ref }} | |
| - name: Promote mainnet (main-s → main, main-us-s → main-us) | |
| run: | | |
| set -euo pipefail | |
| promote() { | |
| local staging="$1" | |
| local prod="$2" | |
| local idx qry prod_idx | |
| idx="$(yq '.indexer.image.tag' "$staging")" | |
| qry="$(yq '.query.image.tag' "$staging")" | |
| export IDX_TAG="$idx" QRY_TAG="$qry" | |
| yq -i '.indexer.image.tag = strenv(IDX_TAG)' "$prod" | |
| yq -i '.query.image.tag = strenv(QRY_TAG)' "$prod" | |
| prod_idx="$(yq '.indexer.image.tag' "$prod")" | |
| if [ "$idx" = "$prod_idx" ]; then | |
| yq -i '.indexer.enabled = false' "$staging" | |
| fi | |
| } | |
| promote environments/main-s.yaml environments/main.yaml | |
| promote environments/main-us-s.yaml environments/main-us.yaml | |
| - name: Commit and push (mainnet) | |
| env: | |
| GIT_AUTHOR_NAME: api-gitops[bot] | |
| GIT_AUTHOR_EMAIL: ${{ secrets.DEPLOYMENT_APP_ID }}+api-gitops[bot]@users.noreply.github.com | |
| GIT_COMMITTER_NAME: api-gitops[bot] | |
| GIT_COMMITTER_EMAIL: ${{ secrets.DEPLOYMENT_APP_ID }}+api-gitops[bot]@users.noreply.github.com | |
| run: | | |
| set -euo pipefail | |
| git add environments/main.yaml environments/main-s.yaml environments/main-us.yaml environments/main-us-s.yaml | |
| if git diff --staged --quiet; then | |
| echo "No mainnet env changes to commit." | |
| exit 0 | |
| fi | |
| git commit -m "chore(cd): promote api-v3-main from staging yamls" | |
| git push origin "HEAD:${{ github.ref_name }}" | |
| promote-api-v3-test: | |
| needs: promote-api-v3-main | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf | |
| with: | |
| app-id: ${{ secrets.DEPLOYMENT_APP_ID }} | |
| private-key: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }} | |
| - name: Checkout release-please branch | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| ref: ${{ github.ref }} | |
| - name: Pull latest (includes mainnet promotion commit) | |
| run: git pull origin "${{ github.ref_name }}" | |
| - name: Promote testnet (test-s → test, test-us-s → test-us) | |
| run: | | |
| set -euo pipefail | |
| promote() { | |
| local staging="$1" | |
| local prod="$2" | |
| local idx qry prod_idx | |
| idx="$(yq '.indexer.image.tag' "$staging")" | |
| qry="$(yq '.query.image.tag' "$staging")" | |
| export IDX_TAG="$idx" QRY_TAG="$qry" | |
| yq -i '.indexer.image.tag = strenv(IDX_TAG)' "$prod" | |
| yq -i '.query.image.tag = strenv(QRY_TAG)' "$prod" | |
| prod_idx="$(yq '.indexer.image.tag' "$prod")" | |
| if [ "$idx" = "$prod_idx" ]; then | |
| yq -i '.indexer.enabled = false' "$staging" | |
| fi | |
| } | |
| promote environments/test-s.yaml environments/test.yaml | |
| promote environments/test-us-s.yaml environments/test-us.yaml | |
| - name: Commit and push (testnet) | |
| env: | |
| GIT_AUTHOR_NAME: api-gitops[bot] | |
| GIT_AUTHOR_EMAIL: ${{ secrets.DEPLOYMENT_APP_ID }}+api-gitops[bot]@users.noreply.github.com | |
| GIT_COMMITTER_NAME: api-gitops[bot] | |
| GIT_COMMITTER_EMAIL: ${{ secrets.DEPLOYMENT_APP_ID }}+api-gitops[bot]@users.noreply.github.com | |
| run: | | |
| set -euo pipefail | |
| git add environments/test.yaml environments/test-s.yaml environments/test-us.yaml environments/test-us-s.yaml | |
| if git diff --staged --quiet; then | |
| echo "No testnet env changes to commit." | |
| exit 0 | |
| fi | |
| git commit -m "chore(cd): promote api-v3-test from staging yamls" | |
| git push origin "HEAD:${{ github.ref_name }}" |