From 86da039cba38f24653ce25491fa26709db09b72f Mon Sep 17 00:00:00 2001 From: Miles <461045745@qq.com> Date: Sun, 10 Dec 2023 18:40:31 +0800 Subject: [PATCH 1/6] Update release.yml --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d615bbb..650aa41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,8 +43,8 @@ jobs: - run: npm run build env: VITE_APP_API: 'https://api.chromepower.xyz/api' - VITE_SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }} - VITE_SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }} # This should be set in the repository's secrets settings + VITE_SUPABASE_URL: $VITE_SUPABASE_URL + VITE_SUPABASE_ANON_KEY: $VITE_SUPABASE_ANON_KEY # This should be set in the repository's secrets settings - name: Compile artifacts ${{ inputs.dry-run && '' || 'and upload them to github release' }} From c3c9fc67126030f27fbf8f7b25eded5aca1d5216 Mon Sep 17 00:00:00 2001 From: Miles <461045745@qq.com> Date: Sun, 10 Dec 2023 18:50:31 +0800 Subject: [PATCH 2/6] Update release.yml --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 650aa41..8f86eaa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,8 +43,8 @@ jobs: - run: npm run build env: VITE_APP_API: 'https://api.chromepower.xyz/api' - VITE_SUPABASE_URL: $VITE_SUPABASE_URL - VITE_SUPABASE_ANON_KEY: $VITE_SUPABASE_ANON_KEY # This should be set in the repository's secrets settings + VITE_SUPABASE_URL: "$VITE_SUPABASE_URL" + VITE_SUPABASE_ANON_KEY: "$VITE_SUPABASE_ANON_KEY" # This should be set in the repository's secrets settings - name: Compile artifacts ${{ inputs.dry-run && '' || 'and upload them to github release' }} From 6ba447be8ee4aae41fc6e60946da5c7e54aaa8b5 Mon Sep 17 00:00:00 2001 From: Miles <461045745@qq.com> Date: Sun, 10 Dec 2023 19:35:59 +0800 Subject: [PATCH 3/6] Update release.yml --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f86eaa..fdc86f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,8 +43,8 @@ jobs: - run: npm run build env: VITE_APP_API: 'https://api.chromepower.xyz/api' - VITE_SUPABASE_URL: "$VITE_SUPABASE_URL" - VITE_SUPABASE_ANON_KEY: "$VITE_SUPABASE_ANON_KEY" # This should be set in the repository's secrets settings + VITE_SUPABASE_URL: ${{ secrets.SUPABASE_URL }} + VITE_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} # This should be set in the repository's secrets settings - name: Compile artifacts ${{ inputs.dry-run && '' || 'and upload them to github release' }} From 258569c807682fa12c161c5d0c09ed9a6d16812c Mon Sep 17 00:00:00 2001 From: Miles <461045745@qq.com> Date: Sun, 10 Dec 2023 21:30:17 +0800 Subject: [PATCH 4/6] Update ci.yml --- .github/workflows/ci.yml | 86 +++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef2362c..e974a99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,43 +1,63 @@ -# This workflow is the entry point for all CI processes. -# It is from here that all other workflows are launched. +name: Release + on: - workflow_dispatch: - push: - tags: - - '*' - branches: - - main - - 'renovate/**' - paths-ignore: - - '.github/**' - - '!.github/workflows/ci.yml' - - '!.github/workflows/release.yml' - - '**.md' - - .editorconfig - - .gitignore - - '.idea/**' - - '.vscode/**' - pull_request: - paths-ignore: - - '.github/**' - - '!.github/workflows/ci.yml' - - '!.github/workflows/release.yml' - - '**.md' - - .editorconfig - - .gitignore - - '.idea/**' - - '.vscode/**' + workflow_call: + inputs: + dry-run: + description: 'Compiles the app but not upload artifacts to distribution server' + default: false + required: false + type: boolean concurrency: - group: ci-${{ github.ref }} + group: release-${{ github.ref }} cancel-in-progress: true +defaults: + run: + shell: 'bash' + jobs: draft_release: permissions: contents: write # Allows this job to create releases - with: - dry-run: ${{ github.event_name != 'push' || (github.ref_type != 'tag' && github.ref_name != 'main') }} - needs: [] - uses: ./.github/workflows/release.yml + strategy: + fail-fast: true + matrix: + os: [ windows-latest ] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 # Updated to use the latest stable version + + - uses: actions/setup-node@v3 + with: + cache: 'npm' + + - run: npm ci + env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Create .env.production.local file + run: | + echo "VITE_APP_API=${{ secrets.VITE_APP_API }}" > .env.production.local + echo "VITE_SUPABASE_URL=${{ secrets.VITE_SUPABASE_URL }}" >> .env.production.local + echo "VITE_SUPABASE_ANON_KEY=${{ secrets.VITE_SUPABASE_ANON_KEY }}" >> .env.production.local + # 在这里添加任何其他需要的环境变量 + + - run: npm run build + + - name: Compile artifacts ${{ inputs.dry-run && '' || 'and upload them to github release' }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 15 + max_attempts: 6 + retry_wait_seconds: 15 + retry_on: error + shell: 'bash' + command: ./node_modules/.bin/electron-builder --config .electron-builder.config.js --publish ${{ inputs.dry-run && 'never' || 'always' }} + env: + GH_TOKEN: ${{ secrets.github_token }} # GitHub token, automatically provided (No need to define this secret in the repo settings) + # Add any other environment variables that are specific to this step, if necessary From 9da4a0d9b12f8133521717180a2447c1d914e415 Mon Sep 17 00:00:00 2001 From: Miles <461045745@qq.com> Date: Sun, 10 Dec 2023 21:31:20 +0800 Subject: [PATCH 5/6] Update release.yml --- .github/workflows/release.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fdc86f0..e974a99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,12 +40,14 @@ jobs: env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + - name: Create .env.production.local file + run: | + echo "VITE_APP_API=${{ secrets.VITE_APP_API }}" > .env.production.local + echo "VITE_SUPABASE_URL=${{ secrets.VITE_SUPABASE_URL }}" >> .env.production.local + echo "VITE_SUPABASE_ANON_KEY=${{ secrets.VITE_SUPABASE_ANON_KEY }}" >> .env.production.local + # 在这里添加任何其他需要的环境变量 + - run: npm run build - env: - VITE_APP_API: 'https://api.chromepower.xyz/api' - VITE_SUPABASE_URL: ${{ secrets.SUPABASE_URL }} - VITE_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} # This should be set in the repository's secrets settings - - name: Compile artifacts ${{ inputs.dry-run && '' || 'and upload them to github release' }} uses: nick-fields/retry@v2 From fb8929358d068c3b3a35dd065d171bf43d21caa8 Mon Sep 17 00:00:00 2001 From: Miles <461045745@qq.com> Date: Sun, 10 Dec 2023 21:33:05 +0800 Subject: [PATCH 6/6] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e974a99..068ce7b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: echo "VITE_APP_API=${{ secrets.VITE_APP_API }}" > .env.production.local echo "VITE_SUPABASE_URL=${{ secrets.VITE_SUPABASE_URL }}" >> .env.production.local echo "VITE_SUPABASE_ANON_KEY=${{ secrets.VITE_SUPABASE_ANON_KEY }}" >> .env.production.local - # 在这里添加任何其他需要的环境变量 + # 在这里添加任何其他需要的环境变量 - run: npm run build