-
Notifications
You must be signed in to change notification settings - Fork 327
Revert "ci: move production deploy to declarative setup, #3063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,28 +6,27 @@ on: | |
| workflow_dispatch: | ||
|
|
||
| env: | ||
| ENVIRONMENT: production | ||
| PROJECT: website | ||
| DECLARATIVE_OWNER: appwrite-labs | ||
| DECLARATIVE_REPOSITORY: assets-applications | ||
| TAG: ${{ github.event.release.tag_name || github.sha }} | ||
| STACK_FILE: docker/production.yml | ||
| REPOSITORY: website | ||
| REGISTRY_USERNAME: christyjacob4 | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout the repo | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Login to DockerHub | ||
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | ||
| uses: docker/build-push-action@v6 | ||
|
Comment on lines
+19
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This revert drops the SHA-pinned action references that PR #3061 introduced (e.g., |
||
| with: | ||
| context: . | ||
| push: true | ||
|
|
@@ -50,40 +49,49 @@ jobs: | |
| "SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}" | ||
| "SENTRY_RELEASE=${{ github.event.release.tag_name }}" | ||
|
|
||
| deploy: | ||
| deploy_kubernetes: | ||
| if: github.event_name != 'release' || !contains(github.event.release.tag_name, '-rc') | ||
| strategy: | ||
| matrix: | ||
| region: [{ full: fra1, short: fra }] | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| concurrency: | ||
| group: declarative-deploy-website | ||
| cancel-in-progress: false | ||
| steps: | ||
| - name: Get token for ${{ env.DECLARATIVE_REPOSITORY }} | ||
| id: app-token | ||
| uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2 | ||
| - name: Checkout the repo | ||
| uses: actions/checkout@v4 | ||
| - name: Install Kubectl | ||
| uses: azure/setup-kubectl@v4 | ||
| - name: Install Helm | ||
| uses: azure/setup-helm@v4 | ||
| - name: Install doctl | ||
| uses: digitalocean/action-doctl@v2 | ||
| with: | ||
| app-id: ${{ vars.DECLARATIVE_DEPLOYMENT_GITHUB_APP_ID }} | ||
| private-key: ${{ secrets.DECLARATIVE_DEPLOYMENT_GITHUB_APP_PRIVATE_KEY }} | ||
| owner: ${{ env.DECLARATIVE_OWNER }} | ||
| repositories: ${{ env.DECLARATIVE_REPOSITORY }} | ||
| token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | ||
| - name: Save DigitalOcean kubeconfig with short-lived credentials | ||
| run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 assets-${{ matrix.region.full }}-prod | ||
|
|
||
| - name: Checkout ${{ env.DECLARATIVE_REPOSITORY }} | ||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| repository: ${{ env.DECLARATIVE_OWNER }}/${{ env.DECLARATIVE_REPOSITORY }} | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| - name: Ensure namespaces exist | ||
| run: | | ||
| kubectl create namespace website --dry-run=client -o yaml | kubectl apply -f - | ||
|
|
||
| - name: Update image tag | ||
| run: yq -i '.website.image.tag = strenv(TAG)' ${{ env.ENVIRONMENT }}/${{ env.PROJECT }}/default.yaml | ||
| - name: Create docker pull secret | ||
| run: | | ||
| kubectl -n website create secret docker-registry ghcr \ | ||
| --docker-server=ghcr.io \ | ||
| --docker-username=${{ secrets.GHCR_USERNAME }} \ | ||
| --docker-password=${{ secrets.GHCR_TOKEN }} \ | ||
| --docker-email=ci@appwrite.io \ | ||
| --dry-run=client -o yaml | kubectl apply -f - | ||
|
|
||
| - name: Create app secrets | ||
| run: | | ||
| kubectl -n website create secret generic website-secrets \ | ||
| --from-literal=STATSIG_SERVER_SECRET='${{ secrets.STATSIG_SERVER_SECRET }}' \ | ||
| --dry-run=client -o yaml | kubectl apply -f - | ||
|
|
||
| - name: Commit and push | ||
| - name: Deploy | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add ${{ env.ENVIRONMENT }}/${{ env.PROJECT }}/default.yaml | ||
| if git diff --cached --quiet; then | ||
| echo "No changes to commit" | ||
| else | ||
| git commit -m "chore(${{ env.ENVIRONMENT }}): ${{ env.PROJECT }} image tag to ${{ env.TAG }}" | ||
| git push | ||
| fi | ||
| helm upgrade --install --namespace website website deploy/website/ \ | ||
| --values deploy/website/environments/production/${{ matrix.region.full }}.values.yaml \ | ||
| --set imagePullSecret='ghcr' \ | ||
| --set version=${{ env.TAG }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STACK_FILE,REPOSITORY, andREGISTRY_USERNAMEare declared inenvbut are never referenced by any step in the workflow. These appear to be leftovers from an older docker-compose-style deployment approach and can be safely removed to keep the workflow clean.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!