-
-
Notifications
You must be signed in to change notification settings - Fork 235
129 lines (110 loc) · 3.24 KB
/
release.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Release
on:
push:
branches:
- main
- alpha
- beta
jobs:
setup:
name: Set environment variables
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
DEPLOY_ENVIRONMENT: ${{ steps.env.outputs.DEPLOY_ENVIRONMENT }}
DEPLOY_SUBDOMAIN: ${{ steps.env.outputs.DEPLOY_SUBDOMAIN }}
steps:
- name: "☁️ compute environment variables"
id: env
run: |
echo "::set-output name=DEPLOY_ENVIRONMENT::$([[ ${{ github.ref_name }} == 'main' ]] && echo 'production' || echo ${{ github.ref_name }})"
echo "::set-output name=DEPLOY_SUBDOMAIN::$([[ ${{ github.ref_name }} == 'main' ]] && echo '' || echo '${{ github.ref_name }}.')"
test:
name: Unit Tests and Lint Checks
uses: open-sauced/hot/.github/workflows/development.yml@main
e2e:
name: E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
- name: "🔧 setup node"
uses: actions/[email protected]
with:
node-version: 18
- name: "🔧 install npm@latest"
run: npm i -g npm@latest
- name: "📦 install dependencies"
uses: bahmutov/npm-install@v1
- name: "🔍 run tests"
run: npm run test:e2e --if-present
build:
name: Build application
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
- name: "🔧 setup node"
uses: actions/[email protected]
with:
node-version: 18
- name: "🔧 install npm@latest"
run: npm i -g npm@latest
- name: "📦 install dependencies"
uses: bahmutov/npm-install@v1
- name: "🚀 static app"
run: npm run build
- name: "📂 production artifacts"
uses: actions/upload-artifact@v2
with:
name: build
path: .next
release:
environment:
name: ${{ needs.setup.outputs.DEPLOY_ENVIRONMENT }}
url: https://${{ needs.setup.outputs.DEPLOY_SUBDOMAIN }}app.opensauced.pizza
name: Semantic release
needs:
- setup
- test
- e2e
- build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.OS_GITHUB_APP_ID }}
private_key: ${{ secrets.OS_GITHUB_APP_PRIVATE_KEY }}
- name: "☁️ checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
- name: "📂 download build artifacts"
uses: actions/download-artifact@v2
with:
name: build
path: build
- name: "🚀 release"
id: semantic-release
uses: open-sauced/release@v1
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
HUSKY: 0
cleanup:
name: Cleanup actions
needs:
- release
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "♻️ remove build artifacts"
uses: geekyeggo/delete-artifact@v1
with:
name: |
build