-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (86 loc) · 2.59 KB
/
nodejs.yaml
File metadata and controls
89 lines (86 loc) · 2.59 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: NodeJS
# This workflow is triggered on pushes to the repository.
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 5
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
env:
NODE_ENV: development
- run: npm run dev:install
- run: npm run prod:install
- run: npm run build --if-present
- run: npm run local
env:
LOG_LEVEL: WARN
NODE_ENV: production
REGION: eu-west-1
- run: npm run local
env:
LOG_LEVEL: DEBUG
NODE_ENV: production
REGION: us-west-1
- run: npm test
env:
LOG_LEVEL: ERROR
NODE_ENV: production
REGION: us-west-1
- name: define version
id: version
run: |
echo "::set-output name=release_timestamp::$(date +%Y-%m-%d_%H.%m)"
echo "::set-output name=tag_hash::${GITHUB_SHA::8}"
echo "::set-output name=changelog::$(git log -1 --pretty=format:"%s")"
- name: build artifact
id: build-artifact
run: |
rm -fr dist/*
npm run build
npm prune --production
mv node_modules/ dist/
cd dist
zip -qr artifact.zip node_modules .
- name: Bump version and push tag
uses: anothrNick/github-tag-action@1.11.0
id: tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
- name: Create Release
id: create_release
uses: actions/create-release@v1
if: "!contains(github.event.head_commit.message, 'skip')"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.tag }}
release_name: Release ${{ steps.version.outputs.release_timestamp}}
draft: false
prerelease: true
body: |
Changes in this Release
- ${{ steps.define-version.outputs.changelog }}
- NodeJS Version: ${{ matrix.node-version }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
if: "!contains(github.event.head_commit.message, 'skip')"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/artifact.zip
asset_name: artifact-${{ steps.tag.outputs.tag }}.zip
asset_content_type: application/zip