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