-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (74 loc) · 2.46 KB
/
ci.yaml
File metadata and controls
74 lines (74 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: CI
on:
push:
branches: [master]
jobs:
build-deploy:
env:
CODEMASH_PROJECT_ID: ${{ secrets.CODEMASH_PROJECT_ID }}
CODEMASH_SECRET_KEY: ${{ secrets.CODEMASH_SECRET_KEY }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache node_modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use nodejs
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Install dependencies
run: npm ci
- name: Check code format
run: npm run format:check
# - name: Run tests
# run: npm test
# env:
# NODE_ENV: test
# - name: Upload test coverage
# uses: actions/upload-artifact@v1
# with:
# name: code-coverage
# path: coverage
- name: Build Project
run: CI='' npm run build
- name: Upload build folder
uses: actions/upload-artifact@v1
with:
name: build
path: dist
- name: Allow download artifacts
uses: actions/download-artifact@v2
# with:
# name: codemash-js-artifact
- name: ZIP Assets
run: |
zip -r build.zip ./dist
- name: Create a release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create issue using REST API
if: failure() && github.event_name == 'push'
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"title": "Automated issue for commit: ${{ github.sha }}",
"body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_."
}' \
--fail