diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cbf5730 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: Release + +on: + pull_request: + push: + release: + branches: [main] + types: + - published + paths-ignore: + - "**.md" + - "**.spec.js" + - ".idea" + - ".vscode" + - ".dockerignore" + - "Dockerfile" + - ".gitignore" + - ".github/**" + - "!.github/workflows/release.yml" + +defaults: + run: + shell: "bash" + +jobs: + build: + # see more environment https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on + runs-on: [ubuntu-20.04] + # https://www.electron.build/multi-platform-build#provided-docker-images + container: electronuserland/builder:wine + + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ELECTRON_BUILDER_CACHE: "/root/.cache/electron-builder" + ELECTRON_CACHE: "/root/.cache/electron" + + strategy: + matrix: + node: ["14"] + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm run test + + # - name: Build dependencies + # run: npm run build + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - uses: actions/upload-artifact@v2 + # with: + # name: upload-artifact + # path: | + # release/electron-vue-vite*.exe + # release/electron-vue-vite*.AppImage + # release/electron-vue-vite*.snap + + # https://github.com/marketplace/actions/electron-builder-action + - name: Compile & Release Electron app + uses: samuelmeuli/action-electron-builder@v1 + with: + build_script_name: prebuild + args: --config electron-builder.json + github_token: ${{ secrets.GITHUB_TOKEN }} + release: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' && needs.get_metadata.outputs.branch == 'main'}} + max_attempts: 5 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c8dcf73 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# use the version that corresponds to your electron version +FROM node:14.16 + +LABEL NAME="electron-wrapper" +LABEL RUN="docker run --rm -it electron-wrapper bash" + +# install electron dependencies or more if your library has other dependencies +RUN apt-get update && apt-get install \ + git libx11-xcb1 libxcb-dri3-0 libxtst6 libnss3 libatk-bridge2.0-0 libgtk-3-0 libxss1 libasound2 \ + -yq --no-install-suggests --no-install-recommends \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# copy the source into /app +WORKDIR /app +COPY . . +RUN chown -R node /app + +# install node modules and perform an electron rebuild +USER node +RUN npm install +RUN npm run build + +USER node +CMD bash \ No newline at end of file