ci: dynamic setup server deploy environment by release tag (#4790)

This commit is contained in:
LongYinan 2023-11-01 15:38:15 +08:00 committed by GitHub
parent 0273ea8b00
commit 2d62ec72a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 27 deletions

View File

@ -38,7 +38,6 @@ jobs:
build-core:
name: Build @affine/core
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v4
@ -58,7 +57,6 @@ jobs:
build-native:
name: Build Native
runs-on: ubuntu-latest
environment: development
needs: build-core
steps:
- uses: actions/checkout@v4
@ -77,7 +75,6 @@ jobs:
desktop-test:
name: Desktop Test
runs-on: ${{ matrix.spec.os }}
environment: development
strategy:
fail-fast: false
# all combinations: macos-latest x64, macos-latest arm64, windows-latest x64, ubuntu-latest x64

View File

@ -39,7 +39,6 @@ jobs:
runs-on: ubuntu-latest
env:
RUSTFLAGS: '-C debuginfo=1'
environment: development
steps:
- uses: actions/checkout@v4
@ -66,7 +65,6 @@ jobs:
server-test:
name: Server Test
runs-on: ubuntu-latest
environment: development
needs: build-storage
services:
postgres:
@ -137,7 +135,6 @@ jobs:
server-e2e-test:
name: Server E2E Test
runs-on: ubuntu-latest
environment: development
needs: build-storage
services:
postgres:
@ -219,7 +216,6 @@ jobs:
server-desktop-e2e-test:
name: Server Desktop E2E Test
runs-on: ubuntu-latest
environment: development
needs: build-storage
services:
postgres:

View File

@ -39,7 +39,6 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v4
@ -75,7 +74,6 @@ jobs:
e2e-plugin-test:
name: E2E Plugin Test
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
@ -115,7 +113,6 @@ jobs:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5]
environment: development
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
@ -153,7 +150,6 @@ jobs:
e2e-migration-test:
name: E2E Migration Test
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
@ -176,7 +172,6 @@ jobs:
unit-test:
name: Unit Test
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v4
- name: Setup Node.js

View File

@ -1,11 +1,6 @@
name: Deploy
on:
push:
branches:
- master
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+'
workflow_dispatch:
inputs:
flavor:
@ -200,7 +195,7 @@ jobs:
deploy:
name: Deploy to cluster
if: ${{ github.event_name == 'workflow_dispatch' || github.ref_type == 'tag' }}
if: ${{ github.event_name == 'workflow_dispatch' }}
environment: ${{ github.event.inputs.flavor }}
permissions:
contents: 'write'

30
.github/workflows/dispatch-deploy.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Dispatch Deploy by tag
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+'
jobs:
dispatch-deploy-by-tag:
runs-on: ubuntu-latest
name: Setup deploy environment
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
extra-flags: 'workspaces focus @affine/monorepo'
hard-link-nm: false
electron-install: false
build-infra: false
build-plugins: false
- name: Setup output value
id: flavor
run: |
node -e "const env = require('semver').parse('${{ github.ref_name }}').prerelease[0] ?? 'stable'; console.log(`flavor=${env}`)" >> "$GITHUB_OUTPUT"
- name: dispatch deploy
uses: benc-uk/workflow-dispatch@v1
with:
workflow: deploy.yml
inputs: '{ "flavor": "${{ steps.flavor.outputs.flavor }}" }'

View File

@ -44,7 +44,6 @@ env:
jobs:
set-build-version:
runs-on: ubuntu-latest
environment: production
outputs:
version: 0.0.0-internal.${{ steps.version.outputs.version }}
steps:
@ -55,7 +54,6 @@ jobs:
before-make:
runs-on: ubuntu-latest
environment: production
needs:
- set-build-version
steps:
@ -83,7 +81,6 @@ jobs:
path: packages/frontend/electron/resources/web-static
make-distribution:
environment: production
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64
# For windows, we need a separate approach

View File

@ -22,7 +22,6 @@ jobs:
publish-storybook:
name: Publish Storybook
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v4
with:

View File

@ -40,7 +40,6 @@ env:
jobs:
before-make:
runs-on: ubuntu-latest
environment: production
outputs:
RELEASE_VERSION: ${{ steps.get-canary-version.outputs.RELEASE_VERSION }}
steps:
@ -76,7 +75,6 @@ jobs:
path: packages/frontend/electron/resources/web-static
make-distribution:
environment: production
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64
# For windows, we need a separate approach
@ -159,7 +157,6 @@ jobs:
path: builds
package-distribution-windows:
environment: production
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64
# For windows, we need a separate approach
@ -235,7 +232,6 @@ jobs:
artifact-name: packaged-win32-x64
make-windows-installer:
environment: production
needs: sign-packaged-artifacts-windows
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64
@ -289,7 +285,6 @@ jobs:
artifact-name: installer-win32-x64
finalize-installer-windows:
environment: production
needs: sign-installer-artifacts-windows
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64