-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
69 lines (61 loc) · 1.84 KB
/
main.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
# GitHub Actions workflow
# https://help.github.com/actions
name: CI/CD
on:
push:
branches: [main]
tags:
- "v*"
pull_request:
branches: [main]
schedule:
- cron: "0 7 * * *"
workflow_dispatch:
inputs:
environment:
description: "Environment"
type: environment
default: "test"
required: true
env:
NODE_VERSION: 20.5.x
VERSION: ${{ github.event.pull_request.number }}
HUSKY: 0
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Configure Node.js and install NPM dependencies
- uses: actions/setup-node@v3
with: { node-version: "${{ env.NODE_VERSION }}", cache: "yarn" }
- run: yarn install
# Analyze code for potential problems
- run: yarn prettier --check .
if: ${{ github.event_name == 'pull_request' }}
- run: yarn lint
if: ${{ github.event_name == 'pull_request' }}
- run: yarn tsc --build
- run: yarn test
if: ${{ github.event_name == 'pull_request' }}
# Compile and save build artifacts
- run: yarn build
- uses: actions/upload-artifact@v3
with: { name: "build", path: "app/dist\nedge/dist\n" }
deploy:
name: "Deploy"
runs-on: ubuntu-latest
needs: [build]
environment:
name: ${{ inputs.environment || 'test' }}
url: ${{ inputs.environment == 'prod' && 'https://example.com' || format('https://{0}.example.com', inputs.environment || 'test') }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with: { node-version: "${{ env.NODE_VERSION }}", cache: "yarn" }
- run: yarn install
- uses: actions/download-artifact@v3
with: { name: "build" }
- run: yarn workspace edge deploy --env=${{ inputs.environment || 'test' }}
if: ${{ false }}