-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (74 loc) · 2.69 KB
/
deploy.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
name: deploy
on:
workflow_dispatch:
push:
branches:
- "test-monorepo-build"
jobs:
build:
runs-on: ubuntu-latest
environment: production
name: deploy
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: bperel
password: ${{ secrets.DOCKER_REGISTRY_TOKEN_DM }}
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: "${GITHUB_REF#refs/heads/}"
# fallback-sha: "ffffff"
- run: |
echo "HEAD: ${{ env.NX_HEAD }}"
echo "BASE: ${{ env.NX_BASE }}"
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- uses: oven-sh/setup-bun@v1
- name: Check apps changed since the last successful commit
run: |
changedApps=$(pnpm -r $changedAppsCommitFilter ls --depth -1 -j)
echo "Changed apps: $changedApps"
- name: Install dependencies
run: |
pnpm -r $changedAppsCommitFilter i
- name: Build apps
run: |
pnpm i -g turbo
export NODE_ENV=production
turbo $changedAppsCommitFilter -F '!~dumili' -F '!~dumili-api' build
- name: Retrieve pre-build files
env:
PRODUCTION_SSH_HOST: ${{ secrets.PRODUCTION_SSH_HOST }}
PRODUCTION_SSH_USER: ${{ secrets.PRODUCTION_SSH_USER }}
PRODUCTION_SSH_KEY: ${{ secrets.PRODUCTION_SSH_KEY }}
run: |
turbo $changedAppsCommitFilter -F '!~ci' -F '!~dumili' -F '!~dumili-api' --concurrency 1 prod:transfer-files-pre
- name: Build and push Docker images
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
turbo $changedAppsCommitFilter -F '!~ci' -F '!~dumili' -F '!~dumili-api' --concurrency 1 prod:build-docker
exit 1
- name: Deploy
run: |
turbo $changedAppsCommitFilter -F '!~ci' -F '!~dumili' -F '!~dumili-api' --concurrency 1 prod:deploy
- name: Send post-build files
env:
PRODUCTION_SSH_HOST: ${{ secrets.PRODUCTION_SSH_HOST }}
PRODUCTION_SSH_USER: ${{ secrets.PRODUCTION_SSH_USER }}
PRODUCTION_SSH_KEY: ${{ secrets.PRODUCTION_SSH_KEY }}
run: |
turbo $changedAppsCommitFilter -F '!~ci' -F '!~dumili' -F '!~dumili-api' --concurrency 1 prod:transfer-files-post