|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + release: |
| 7 | + branches: [main] |
| 8 | + types: |
| 9 | + - published |
| 10 | + paths-ignore: |
| 11 | + - "**.md" |
| 12 | + - "**.spec.js" |
| 13 | + - ".idea" |
| 14 | + - ".vscode" |
| 15 | + - ".dockerignore" |
| 16 | + - "Dockerfile" |
| 17 | + - ".gitignore" |
| 18 | + - ".github/**" |
| 19 | + - "!.github/workflows/release.yml" |
| 20 | + |
| 21 | +defaults: |
| 22 | + run: |
| 23 | + shell: "bash" |
| 24 | + |
| 25 | +jobs: |
| 26 | + build: |
| 27 | + # see more environment https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on |
| 28 | + runs-on: [ubuntu-20.04] |
| 29 | + # https://www.electron.build/multi-platform-build#provided-docker-images |
| 30 | + container: electronuserland/builder:wine |
| 31 | + |
| 32 | + env: |
| 33 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + ELECTRON_BUILDER_CACHE: "/root/.cache/electron-builder" |
| 35 | + ELECTRON_CACHE: "/root/.cache/electron" |
| 36 | + |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + node: ["14"] |
| 40 | + |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v2 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + |
| 46 | + - name: Use Node.js ${{ matrix.node }} |
| 47 | + uses: actions/setup-node@v2 |
| 48 | + with: |
| 49 | + node-version: ${{ matrix.node }} |
| 50 | + |
| 51 | + - name: Install dependencies |
| 52 | + run: npm install |
| 53 | + |
| 54 | + - name: Run tests |
| 55 | + run: npm run test |
| 56 | + |
| 57 | + # - name: Build dependencies |
| 58 | + # run: npm run build |
| 59 | + # env: |
| 60 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + |
| 62 | + # - uses: actions/upload-artifact@v2 |
| 63 | + # with: |
| 64 | + # name: upload-artifact |
| 65 | + # path: | |
| 66 | + # release/electron-vue-vite*.exe |
| 67 | + # release/electron-vue-vite*.AppImage |
| 68 | + # release/electron-vue-vite*.snap |
| 69 | + |
| 70 | + # https://github.com/marketplace/actions/electron-builder-action |
| 71 | + - name: Compile & Release Electron app |
| 72 | + uses: samuelmeuli/action-electron-builder@v1 |
| 73 | + with: |
| 74 | + build_script_name: prebuild |
| 75 | + args: --config electron-builder.json |
| 76 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + release: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' && needs.get_metadata.outputs.branch == 'main'}} |
| 78 | + max_attempts: 5 |
0 commit comments