Skip to content

Commit 2d14874

Browse files
committed
Add GH Actions workflows
1 parent 449fa5b commit 2d14874

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
test:
11+
name: Test / OS ${{ matrix.platform }} / Node ${{ matrix.node }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
platform: [ubuntu-latest]
16+
node: [12.x]
17+
18+
runs-on: ${{ matrix.platform }}
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Set up DB
24+
run: docker-compose up -d
25+
26+
- uses: actions/cache@v1
27+
with:
28+
path: ~/.npm
29+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
30+
restore-keys: |
31+
${{ runner.os }}-node-
32+
33+
- name: Set up Node
34+
uses: actions/setup-node@v1
35+
with:
36+
node-version: ${{ matrix.node }}
37+
38+
- run: npm install
39+
40+
- run: npm run dev &
41+
42+
- name: Sleep for 30s
43+
uses: jakejarvis/wait-action@v0.1.0
44+
with:
45+
time: '30s'
46+
47+
- run: npm test

.github/workflows/release.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
8+
jobs:
9+
release:
10+
name: Release / Node ${{ matrix.node }}
11+
12+
strategy:
13+
matrix:
14+
node: ['14']
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: actions/cache@v1
22+
with:
23+
path: ~/.npm
24+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
25+
restore-keys: |
26+
${{ runner.os }}-node-
27+
28+
- name: Set up Node
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: ${{ matrix.node }}
32+
33+
- name: Prepare release
34+
run: |
35+
npm install
36+
npm run dist
37+
tar -czvf pg-api-linux.tar.gz -C ./bin start-linux
38+
tar -czvf pg-api-macos.tar.gz -C ./bin start-macos
39+
tar -czvf pg-api-windows.tar.gz -C ./bin start-win.exe
40+
41+
- name: Create release
42+
id: create_release
43+
uses: actions/create-release@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
tag_name: ${{ github.ref }}
48+
release_name: ${{ github.ref }}
49+
50+
- name: Upload linux release asset
51+
uses: actions/upload-release-asset@v1
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
upload_url: ${{ steps.create_release.outputs.upload_url }}
56+
asset_path: ./pg-api-linux.tar.gz
57+
asset_name: pg-api-linux.tar.gz
58+
asset_content_type: application/gzip
59+
60+
- name: Upload macos release asset
61+
uses: actions/upload-release-asset@v1
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
upload_url: ${{ steps.create_release.outputs.upload_url }}
66+
asset_path: ./pg-api-macos.tar.gz
67+
asset_name: pg-api-macos.tar.gz
68+
asset_content_type: application/gzip
69+
70+
- name: Upload windows release asset
71+
uses: actions/upload-release-asset@v1
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
with:
75+
upload_url: ${{ steps.create_release.outputs.upload_url }}
76+
asset_path: ./pg-api-windows.tar.gz
77+
asset_name: pg-api-windows.tar.gz
78+
asset_content_type: application/gzip
79+
80+
- name: Fly.io deploy
81+
uses: superfly/flyctl-actions@1.0
82+
env:
83+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
84+
with:
85+
args: 'deploy'

0 commit comments

Comments
 (0)