-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (73 loc) · 2.47 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# This is a basic workflow to help you get started with Actions
name: Build and deploy [dev / prod]
run-name: Build and deploy to ${{ github.ref == 'refs/heads/dev' && 'development' || 'production' }}
# Controls when the action will run.
on:
workflow_dispatch:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: ['main', 'dev']
env:
node_version: 20
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "install"
build-and-publish:
name: Build and publish
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
cache: 'pnpm'
- run: pnpm install --prod
- uses: actions/checkout@v4
- name: Get env name
id: envRunner
run: echo "env=${{ github.ref == 'refs/heads/dev' && 'development' || 'production' }}" >> $GITHUB_OUTPUT
- name: Build and deploy
uses: ./.github/actions/build-and-deploy
with:
environment: ${{ steps.envRunner.outputs.env }}
node_version: ${{ env.node_version }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
- name: Set output variables
id: success
run: echo "buildStatus=success" >> $GITHUB_OUTPUT
github-release:
needs: [ build-and-publish ]
runs-on: ubuntu-latest
name: Generate Release Notes
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
branches: |
[
'main',
{
name: 'dev',
prerelease: true
}
]
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUNNER_DEBUG: 1