Skip to content

Commit fba5e69

Browse files
authored
Merge pull request #62 from oceanlvr/main
feat(ci): add github action 🔨
2 parents d5df9d6 + c653a73 commit fba5e69

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# use the version that corresponds to your electron version
2+
FROM node:14.16
3+
4+
LABEL NAME="electron-wrapper"
5+
LABEL RUN="docker run --rm -it electron-wrapper bash"
6+
7+
# install electron dependencies or more if your library has other dependencies
8+
RUN apt-get update && apt-get install \
9+
git libx11-xcb1 libxcb-dri3-0 libxtst6 libnss3 libatk-bridge2.0-0 libgtk-3-0 libxss1 libasound2 \
10+
-yq --no-install-suggests --no-install-recommends \
11+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
12+
13+
# copy the source into /app
14+
WORKDIR /app
15+
COPY . .
16+
RUN chown -R node /app
17+
18+
# install node modules and perform an electron rebuild
19+
USER node
20+
RUN npm install
21+
RUN npm run build
22+
23+
USER node
24+
CMD bash

0 commit comments

Comments
 (0)