Skip to content

Commit

Permalink
ci: compile and deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
cawa-93 committed Nov 12, 2024
1 parent 01951ff commit 99429cd
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 46 deletions.
95 changes: 50 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,57 +40,62 @@ jobs:
- uses: actions/checkout@v4
- id: COMMIT_TIMESTAMP
run: echo "COMMIT_TIMESTAMP=$(git show -s --format=%ct ${{ github.sha }})" >> $GITHUB_OUTPUT
- id: APP_CHANNEL
run: echo "APP_CHANNEL=$(if [[ "${{ github.ref }}" == 'refs/heads/develop' ]]; then echo 'beta'; else echo 'latest'; fi)" >> $GITHUB_OUTPUT
- id: APP_VERSION
run: echo "APP_VERSION=3.0.${{ steps.COMMIT_TIMESTAMP.outputs.COMMIT_TIMESTAMP }}$(if [[ "${{ steps.APP_CHANNEL.outputs.APP_CHANNEL }}" != 'latest' ]]; then echo '-${{ steps.APP_CHANNEL.outputs.APP_CHANNEL }}'; else echo ''; fi)" >> $GITHUB_OUTPUT
- run: |
echo "- \`COMMIT_TIMESTAMP\`: ${{ steps.COMMIT_TIMESTAMP.outputs.COMMIT_TIMESTAMP }}" >> $GITHUB_STEP_SUMMARY
echo "- \`APP_CHANNEL\`: ${{ steps.APP_CHANNEL.outputs.APP_CHANNEL }}" >> $GITHUB_STEP_SUMMARY
echo "- \`APP_VERSION\`: ${{ steps.APP_VERSION.outputs.APP_VERSION }}" >> $GITHUB_STEP_SUMMARY
tests:
compile:
needs:
- prepare
uses: ./.github/workflows/tests.yml
uses: ./.github/workflows/compile.yml
with:
renderer-template: ${{ matrix.renderer-template }}
app-version: ${{ needs.prepare.outputs.APP_VERSION }}-${{ matrix.renderer-template }}
strategy:
fail-fast: false
matrix:
renderer-template:
- vanilla
- vanilla-ts
- vue
- vue-ts
- react
- react-ts
- react-swc
- react-swc-ts
- preact
- preact-ts
- lit
- lit-ts
- svelte
- svelte-ts
- solid
- solid-ts
# Qwik Has unresolved upstream issue. So I decided to torn it off for now
# - qwik
# - qwik-ts


dependabot:
permissions:
contents: write
pull-requests: write
needs:
- tests
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'cawa-93/vite-electron-builder'
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
app-version: ${{ needs.prepare.outputs.APP_VERSION }}
# tests:
# needs:
# - prepare
# uses: ./.github/workflows/tests.yml
# with:
# renderer-template: ${{ matrix.renderer-template }}
# app-version: ${{ needs.prepare.outputs.APP_VERSION }}
# strategy:
# fail-fast: false
# matrix:
# renderer-template:
# - vanilla
# - vanilla-ts
# - vue
# - vue-ts
# - react
# - react-ts
# - react-swc
# - react-swc-ts
# - preact
# - preact-ts
# - lit
# - lit-ts
# - svelte
# - svelte-ts
# - solid
# - solid-ts
## Qwik Has unresolved upstream issue. So I decided to torn it off for now
## - qwik
## - qwik-ts
#
#
# dependabot:
# permissions:
# contents: write
# pull-requests: write
# needs:
# - tests
# runs-on: ubuntu-latest
# if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'cawa-93/vite-electron-builder'
# steps:
# - name: Enable auto-merge for Dependabot PRs
# run: gh pr merge --auto --rebase "$PR_URL"
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
49 changes: 49 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on:
workflow_call:
inputs:
renderer-template:
required: true
type: string
app-version:
required: true
type: string

defaults:
run:
shell: 'bash'

env:
NODE_NO_WARNINGS: 1
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
npm_config_audit: false
npm_config_fund: false

jobs:
compile:
strategy:
fail-fast: true
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init-template-with-renderer
name: Init template with "${{inputs.renderer-template}}" renderer
with:
renderer-template: ${{inputs.renderer-template}}
- run: npm run compile -- --publish 'never' -c.extraMetadata.version=${{inputs.app-version}}
- run: rm -rf packages
- run: npm run compile -- -c.extraMetadata.version=${{inputs.app-version}}-${{inputs.renderer-template}}
env:
VITE_DISTRIBUTION_CHANNEL: ${{inputs.renderer-template}}

- name: Upload compilation artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{inputs.app-version}}-${{inputs.renderer-template}}
path: |
dist/*latest.yml
dist/*-${{inputs.app-version}}-${{inputs.renderer-template}}*
31 changes: 31 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
workflow_call:
inputs:
renderer-template:
required: true
type: string
app-version:
required: true
type: string

defaults:
run:
shell: 'bash'

env:
NODE_NO_WARNINGS: 1
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
npm_config_audit: false
npm_config_fund: false

jobs:
deploy:
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
environment: ${{inputs.renderer-template}}
runs-on: ${{ matrix.os }}
2 changes: 1 addition & 1 deletion .idea/jsonSchemas.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/main/src/modules/AutoUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export class AutoUpdater implements AppModule {
updater.logger = this.#logger || null;
updater.fullChangelog = true;

if (import.meta.env.VITE_DISTRIBUTION_CHANNEL) {
updater.channel = import.meta.env.VITE_DISTRIBUTION_CHANNEL;
}

return await updater.checkForUpdatesAndNotify(this.#notification);
} catch (error) {
if (error instanceof Error) {
Expand Down

0 comments on commit 99429cd

Please sign in to comment.