mirror of
https://github.com/toeverything/AFFiNE.git
synced 2025-01-04 19:16:04 +03:00
4610f1e934
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [slackapi/slack-github-action](https://redirect.github.com/slackapi/slack-github-action) | action | major | `v1.27.0` -> `v2.0.0` | --- ### Release Notes <details> <summary>slackapi/slack-github-action (slackapi/slack-github-action)</summary> ### [`v2.0.0`](https://redirect.github.com/slackapi/slack-github-action/compare/v1.27.1...v2.0.0) [Compare Source](https://redirect.github.com/slackapi/slack-github-action/compare/v1.27.1...v2.0.0) ### [`v1.27.1`](https://redirect.github.com/slackapi/slack-github-action/releases/tag/v1.27.1): Slack Send V1.27.1 [Compare Source](https://redirect.github.com/slackapi/slack-github-action/compare/v1.27.0...v1.27.1) ##### What's changed This release tags multiple updates to dependencies and a clarification in documentation 📚 No changes are needed to update from `slackapi/slack-github-action@v1.27.0` - other than bumping the version - but ongoing development is now happening on version `@v2` and `@v1` is no longer planning to receive significant updates after this. Please stay tuned for upcoming changes, and may all of your workflows run well ❤️ ##### 📚 Documentation - docs(fix): reference octokit context and github event webhook payloads in variables in [https://github.com/slackapi/slack-github-action/pull/348](https://redirect.github.com/slackapi/slack-github-action/pull/348) - thanks [@​zimeg](https://redirect.github.com/zimeg)! ##### 🧪 Maintenance - ci: include the slack health score as part of ci tests in [https://github.com/slackapi/slack-github-action/pull/346](https://redirect.github.com/slackapi/slack-github-action/pull/346) - thanks [@​zimeg](https://redirect.github.com/zimeg)! ##### 📦 Dependencies - build(deps): bump axios from 1.7.5 to 1.7.7 in [https://github.com/slackapi/slack-github-action/pull/334](https://redirect.github.com/slackapi/slack-github-action/pull/334) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps-dev): bump mocha from 10.7.0 to 10.7.3 in [https://github.com/slackapi/slack-github-action/pull/335](https://redirect.github.com/slackapi/slack-github-action/pull/335) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps-dev): bump eslint-plugin-jsdoc from 48.10.2 to 50.2.2 in [https://github.com/slackapi/slack-github-action/pull/336](https://redirect.github.com/slackapi/slack-github-action/pull/336) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps): bump [@​slack/web-api](https://redirect.github.com/slack/web-api) from 7.3.4 to 7.5.0 in [https://github.com/slackapi/slack-github-action/pull/339](https://redirect.github.com/slackapi/slack-github-action/pull/339) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps-dev): bump eslint-plugin-import from 2.29.1 to 2.30.0 in [https://github.com/slackapi/slack-github-action/pull/341](https://redirect.github.com/slackapi/slack-github-action/pull/341) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps-dev): bump eslint-plugin-jsdoc from 50.2.2 to 50.3.1 in [https://github.com/slackapi/slack-github-action/pull/344](https://redirect.github.com/slackapi/slack-github-action/pull/344) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps-dev): bump nyc from 17.0.0 to 17.1.0 in [https://github.com/slackapi/slack-github-action/pull/342](https://redirect.github.com/slackapi/slack-github-action/pull/342) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps-dev): bump sinon from 18.0.0 to 19.0.2 in [https://github.com/slackapi/slack-github-action/pull/343](https://redirect.github.com/slackapi/slack-github-action/pull/343) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps-dev): bump mocha from 10.7.3 to 10.8.2 in [https://github.com/slackapi/slack-github-action/pull/350](https://redirect.github.com/slackapi/slack-github-action/pull/350) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps): bump [@​slack/web-api](https://redirect.github.com/slack/web-api) from 7.5.0 to 7.7.0 in [https://github.com/slackapi/slack-github-action/pull/351](https://redirect.github.com/slackapi/slack-github-action/pull/351) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps-dev): bump eslint-plugin-import from 2.30.0 to 2.31.0 in [https://github.com/slackapi/slack-github-action/pull/352](https://redirect.github.com/slackapi/slack-github-action/pull/352) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps-dev): bump eslint-plugin-jsdoc from 50.3.1 to 50.4.3 in [https://github.com/slackapi/slack-github-action/pull/353](https://redirect.github.com/slackapi/slack-github-action/pull/353) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps): bump [@​actions/core](https://redirect.github.com/actions/core) from 1.10.1 to 1.11.1 in [https://github.com/slackapi/slack-github-action/pull/354](https://redirect.github.com/slackapi/slack-github-action/pull/354) - thanks [@​dependabot](https://redirect.github.com/dependabot)! - build(deps): bump codecov/codecov-action from 4.5.0 to 4.6.0 in [https://github.com/slackapi/slack-github-action/pull/355](https://redirect.github.com/slackapi/slack-github-action/pull/355) - thanks [@​dependabot](https://redirect.github.com/dependabot)! **Full Changelog**: https://github.com/slackapi/slack-github-action/compare/v1.27.0...v1.27.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMS41IiwidXBkYXRlZEluVmVyIjoiMzkuMTEuNSIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
204 lines
8.4 KiB
YAML
204 lines
8.4 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
flavor:
|
|
description: 'Select what enverionment to deploy to'
|
|
type: choice
|
|
default: canary
|
|
options:
|
|
- canary
|
|
- beta
|
|
- stable
|
|
- internal
|
|
env:
|
|
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
|
|
|
permissions:
|
|
contents: 'write'
|
|
id-token: 'write'
|
|
packages: 'write'
|
|
|
|
jobs:
|
|
output-prev-version:
|
|
name: Output previous version
|
|
runs-on: ubuntu-latest
|
|
environment: ${{ github.event.inputs.flavor }}
|
|
outputs:
|
|
prev: ${{ steps.print.outputs.version }}
|
|
namespace: ${{ steps.print.outputs.namespace }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Auth to Cluster
|
|
uses: './.github/actions/cluster-auth'
|
|
with:
|
|
gcp-project-number: ${{ secrets.GCP_PROJECT_NUMBER }}
|
|
gcp-project-id: ${{ secrets.GCP_PROJECT_ID }}
|
|
service-account: ${{ secrets.GCP_HELM_DEPLOY_SERVICE_ACCOUNT }}
|
|
cluster-name: ${{ secrets.GCP_CLUSTER_NAME }}
|
|
cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }}
|
|
- name: Output previous version
|
|
id: print
|
|
run: |
|
|
namespace=""
|
|
if [ "${{ github.event.inputs.flavor }}" = "canary" ]; then
|
|
namespace="dev"
|
|
elif [ "${{ github.event.inputs.flavor }}" = "beta" ]; then
|
|
namespace="beta"
|
|
elif [ "${{ github.event.inputs.flavor }}" = "stable" ]; then
|
|
namespace="production"
|
|
else
|
|
echo "Invalid flavor: ${{ github.event.inputs.flavor }}"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Namespace set to: $namespace"
|
|
|
|
# Get the previous version from the deployment
|
|
prev_version=$(kubectl get deployment -n $namespace affine-graphql -o=jsonpath='{.spec.template.spec.containers[0].image}' | awk -F '-' '{print $3}')
|
|
|
|
echo "Previous version: $prev_version"
|
|
echo "version=$prev_version" >> $GITHUB_OUTPUT
|
|
echo "namesapce=$namespace" >> $GITHUB_OUTPUT
|
|
|
|
build-images:
|
|
name: Build Images
|
|
uses: ./.github/workflows/build-images.yml
|
|
secrets: inherit
|
|
with:
|
|
flavor: ${{ github.event.inputs.flavor }}
|
|
|
|
deploy:
|
|
name: Deploy to cluster
|
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
environment: ${{ github.event.inputs.flavor }}
|
|
needs:
|
|
- build-images
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Version
|
|
id: version
|
|
uses: ./.github/actions/setup-version
|
|
- name: Deploy to ${{ github.event.inputs.flavor }}
|
|
uses: ./.github/actions/deploy
|
|
with:
|
|
build-type: ${{ github.event.inputs.flavor }}
|
|
gcp-project-number: ${{ secrets.GCP_PROJECT_NUMBER }}
|
|
gcp-project-id: ${{ secrets.GCP_PROJECT_ID }}
|
|
service-account: ${{ secrets.GCP_HELM_DEPLOY_SERVICE_ACCOUNT }}
|
|
cluster-name: ${{ secrets.GCP_CLUSTER_NAME }}
|
|
cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }}
|
|
env:
|
|
APP_VERSION: ${{ steps.version.outputs.APP_VERSION }}
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
CANARY_DEPLOY_HOST: ${{ secrets.CANARY_DEPLOY_HOST }}
|
|
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
|
|
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
|
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
|
CAPTCHA_TURNSTILE_SECRET: ${{ secrets.CAPTCHA_TURNSTILE_SECRET }}
|
|
COPILOT_OPENAI_API_KEY: ${{ secrets.COPILOT_OPENAI_API_KEY }}
|
|
COPILOT_FAL_API_KEY: ${{ secrets.COPILOT_FAL_API_KEY }}
|
|
COPILOT_UNSPLASH_API_KEY: ${{ secrets.COPILOT_UNSPLASH_API_KEY }}
|
|
METRICS_CUSTOMER_IO_TOKEN: ${{ secrets.METRICS_CUSTOMER_IO_TOKEN }}
|
|
MAILER_SENDER: ${{ secrets.OAUTH_EMAIL_SENDER }}
|
|
MAILER_USER: ${{ secrets.OAUTH_EMAIL_LOGIN }}
|
|
MAILER_PASSWORD: ${{ secrets.OAUTH_EMAIL_PASSWORD }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
AFFINE_GOOGLE_CLIENT_ID: ${{ secrets.AFFINE_GOOGLE_CLIENT_ID }}
|
|
AFFINE_GOOGLE_CLIENT_SECRET: ${{ secrets.AFFINE_GOOGLE_CLIENT_SECRET }}
|
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
|
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
|
|
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
|
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
|
|
GCLOUD_CONNECTION_NAME: ${{ secrets.GCLOUD_CONNECTION_NAME }}
|
|
GCLOUD_CLOUD_SQL_INTERNAL_ENDPOINT: ${{ secrets.GCLOUD_CLOUD_SQL_INTERNAL_ENDPOINT }}
|
|
REDIS_HOST: ${{ secrets.REDIS_HOST }}
|
|
REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }}
|
|
CLOUD_SQL_IAM_ACCOUNT: ${{ secrets.CLOUD_SQL_IAM_ACCOUNT }}
|
|
STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }}
|
|
STRIPE_WEBHOOK_KEY: ${{ secrets.STRIPE_WEBHOOK_KEY }}
|
|
STATIC_IP_NAME: ${{ secrets.STATIC_IP_NAME }}
|
|
|
|
deploy-done:
|
|
needs:
|
|
- output-prev-version
|
|
- build-images
|
|
- deploy
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
name: Post deploy message
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: toeverything/blocksuite
|
|
path: blocksuite
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
- name: Setup Node.js
|
|
uses: ./.github/actions/setup-node
|
|
with:
|
|
extra-flags: 'workspaces focus @affine/changelog'
|
|
electron-install: false
|
|
- name: Output deployed info
|
|
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
|
|
id: set_info
|
|
run: |
|
|
if [ "${{ github.event.inputs.flavor }}" = "canary" ]; then
|
|
echo "deployed_url=https://affine.fail" >> $GITHUB_OUTPUT
|
|
elif [ "${{ github.event.inputs.flavor }}" = "beta" ]; then
|
|
echo "deployed_url=https://insider.affine.pro" >> $GITHUB_OUTPUT
|
|
elif [ "${{ github.event.inputs.flavor }}" = "stable" ]; then
|
|
echo "deployed_url=https://app.affine.pro" >> $GITHUB_OUTPUT
|
|
else
|
|
exit 1
|
|
fi
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
- name: Post Success event to a Slack channel
|
|
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
|
|
run: node ./tools/changelog/index.js
|
|
env:
|
|
CHANNEL_ID: ${{ secrets.RELEASE_SLACK_CHNNEL_ID }}
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
DEPLOYED_URL: ${{ steps.set_info.outputs.deployed_url }}
|
|
PREV_VERSION: ${{ needs.output-prev-version.outputs.prev }}
|
|
NAMESPACE: ${{ needs.output-prev-version.outputs.namespace }}
|
|
DEPLOYMENT: 'SERVER'
|
|
FLAVOR: ${{ github.event.inputs.flavor }}
|
|
BLOCKSUITE_REPO_PATH: ${{ github.workspace }}/blocksuite
|
|
- name: Post Failed event to a Slack channel
|
|
id: failed-slack
|
|
uses: slackapi/slack-github-action@v2.0.0
|
|
if: ${{ always() && contains(needs.*.result, 'failure') }}
|
|
with:
|
|
method: chat.postMessage
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
channel: ${{ secrets.RELEASE_SLACK_CHNNEL_ID }}
|
|
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy failed `${{ github.event.inputs.flavor }}`>"
|
|
blocks:
|
|
- type: section
|
|
text:
|
|
type: mrkdwn
|
|
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy failed `${{ github.event.inputs.flavor }}`>"
|
|
- name: Post Cancel event to a Slack channel
|
|
id: cancel-slack
|
|
uses: slackapi/slack-github-action@v2.0.0
|
|
if: ${{ always() && contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') }}
|
|
with:
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
method: chat.postMessage
|
|
payload: |
|
|
channel: ${{ secrets.RELEASE_SLACK_CHNNEL_ID }}
|
|
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy cancelled `${{ github.event.inputs.flavor }}`>"
|
|
blocks:
|
|
- type: section
|
|
text:
|
|
type: mrkdwn
|
|
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy cancelled `${{ github.event.inputs.flavor }}`>"
|