-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (108 loc) · 3.44 KB
/
release_blog.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Blog Production Deployment
on:
workflow_dispatch:
inputs:
version:
description: Bump Version
default: v1.0.0
required: true
git-ref:
description: Git Ref (Optional)
required: false
# Jobs to carry out
jobs:
lint:
runs-on: ubuntu-latest
steps:
# Get code from repo
- name: Clone Repository (Latest)
uses: actions/checkout@v2
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v2
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
# Install NodeJS
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
# Run rush install and build on our code
- name: Install dependencies
run: |
node common/scripts/install-run-rush.js change -v
node common/scripts/install-run-rush.js install
node common/scripts/install-run-rush.js build
# Run eslint to check all packages
- name: Lint packages
run: node common/scripts/install-run-rush.js lint
test:
runs-on: ubuntu-latest
env:
CI: true
steps:
# Get code from repo
- name: Clone Repository (Latest)
uses: actions/checkout@v2
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v2
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
# Install NodeJS
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
# Run rush install
- name: Install dependencies
run: |
node common/scripts/install-run-rush.js change -v
node common/scripts/install-run-rush.js install
node common/scripts/install-run-rush.js build
# Run unit tests for all packages
- name: Run tests
run: node common/scripts/install-run-rush.js test
deploy:
# Operating system to run job on
runs-on: ubuntu-latest
needs: [lint, test]
# Steps in job
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
steps:
# Get code from repo
- name: Clone Repository (Latest)
uses: actions/checkout@v2
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v2
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
# Install NodeJS
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
# Run rush install and build on our code
- name: Install dependencies
run: |
node common/scripts/install-run-rush.js change -v
node common/scripts/install-run-rush.js install
# Build app
- name: Build blog app
working-directory: apps/blog
run: |
cp ./env_overrides/production.ini .env.local
node $GITHUB_WORKSPACE/common/scripts/install-run-rush.js build --verbose --to-except @bereghici/blog-app
npx netlify-cli build
npx netlify-cli deploy --prod
# Create release tag
- name: Create tag
run: |
git tag ${{ github.event.inputs.version }}
git push origin --tags