diff --git a/.github/workflows/build-deploy-[all].yml b/.github/workflows/build-deploy-[all].yml index 34a4b18..920eee4 100644 --- a/.github/workflows/build-deploy-[all].yml +++ b/.github/workflows/build-deploy-[all].yml @@ -17,7 +17,11 @@ jobs: name: Build & Deploy / ${{ matrix.package }} strategy: matrix: - package: [home] + include: + - package: home + package_cap: HOME + - package: admin + package_cap: ADMIN uses: ./.github/workflows/build-deploy.yml with: package: ${{ matrix.package }} diff --git a/.github/workflows/build-deploy-admin.yml b/.github/workflows/build-deploy-admin.yml new file mode 100644 index 0000000..baa04c9 --- /dev/null +++ b/.github/workflows/build-deploy-admin.yml @@ -0,0 +1,18 @@ +name: Build & Deploy / admin +run-name: Build & Deploy (${{ github.ref_name }}/admin) + +on: + push: + paths: + - 'packages/admin/**' + +concurrency: build-deploy-admin-${{ github.ref }} + +jobs: + build-deploy-admin: + name: Build & Deploy + uses: ./.github/workflows/build-deploy.yml + with: + package: admin + package_cap: ADMIN + secrets: inherit diff --git a/.github/workflows/build-deploy-home.yml b/.github/workflows/build-deploy-home.yml index 2d84f61..3c67027 100644 --- a/.github/workflows/build-deploy-home.yml +++ b/.github/workflows/build-deploy-home.yml @@ -14,4 +14,5 @@ jobs: uses: ./.github/workflows/build-deploy.yml with: package: home + package_cap: HOME secrets: inherit diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 96a9129..d4dc8cc 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -4,6 +4,9 @@ on: package: required: true type: string + package_cap: + required: true + type: string secrets: PROD_CLOUD_SSH_URI: required: true @@ -15,6 +18,8 @@ on: required: true PROD_CLOUD_PROJECT_ROOT: required: true + PROD_HOME_PM2_CONF_ENV: + PROD_ADMIN_PM2_CONF_ENV: jobs: build: @@ -42,6 +47,19 @@ jobs: run: pnpm -F ${{ inputs.package }} install - name: Build standalone server run: 'pnpm run build:${{ inputs.package }}' + - name: Replace environment variables + run: | + [ -z "${{ secrets[format('PROD_{0}_PM2_CONF_ENV', inputs.package_cap)] }}" ] || ( + echo "${{ secrets[format('PROD_{0}_PM2_CONF_ENV', inputs.package_cap)] }}" | + awk ' + /env: {/,/}/ { + if (/env: {/ || /}/) print; + while((getline < "/dev/stdin") > 0) print; + next + } + { print } + ' packages/${{ inputs.package }}/ecosystem.config.js + ) - name: Package the build run: | cd packages/${{ inputs.package }} diff --git a/.gitignore b/.gitignore index cf53a67..efabecb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ !.idea/jsLinters/ !.idea/icon.svg +### Dotenv +.env + ### Node.js # Logs *.log* diff --git a/.idea/dictionaries/thrrip.xml b/.idea/dictionaries/thrrip.xml index e2cf3d2..9cd599a 100644 --- a/.idea/dictionaries/thrrip.xml +++ b/.idea/dictionaries/thrrip.xml @@ -6,6 +6,7 @@ bilibili dscreen fortawesome + getline nuxtjs shopt webmanifest diff --git a/.run/build_admin.run.xml b/.run/build_admin.run.xml new file mode 100644 index 0000000..f6ec0fd --- /dev/null +++ b/.run/build_admin.run.xml @@ -0,0 +1,12 @@ + + + + + +