-
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (77 loc) · 2.38 KB
/
deploy-to-staging.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
name: 'Deploy to staging'
env:
FONTAWESOME_PACKAGE_TOKEN: ${{ secrets.FONTAWESOME_PACKAGE_TOKEN }}
REGISTRY: ghcr.io
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
projects: ${{ steps.projects.outputs.projects }}
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Set up Moon Toolchain
uses: 'moonrepo/setup-toolchain@v0'
- name: Define Projects
id: projects
run: |
echo "projects=$(moon query projects projectType=application | sed 's/ |/|/g' | awk -F '|' '{print "\"" $1 "\""}' | paste -sd, - | sed 's/^/\[/; s/$/\]/')" >> "$GITHUB_OUTPUT"
buildandpush:
name: '${{ matrix.projects }} | Build and push docker images'
needs: define-matrix
continue-on-error: true
strategy:
fail-fast: false
matrix:
projects: ${{ fromJSON(needs.define-matrix.outputs.projects) }}
runs-on: ubuntu-latest
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Set up Moon Toolchain
uses: 'moonrepo/setup-toolchain@v0'
with:
auto-install: true
- run: yarn --version
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build and push docker images'
run: 'moon ci ${{ matrix.projects }}:staging-docker-push'
deploy:
name: 'Deploy to VPS'
runs-on: ubuntu-latest
needs:
- define-matrix
- buildandpush
strategy:
fail-fast: false
matrix:
projects: ${{ fromJSON(needs.define-matrix.outputs.projects) }}
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Set up Moon Toolchain
uses: 'moonrepo/setup-toolchain@v0'
- name: 'Redeploy from Dokploy on VPS'
env:
DOKPLOY_API_TOKEN: ${{ secrets.DOKPLOY_API_TOKEN }}
DOKPLOY_API_URL: ${{ secrets.DOKPLOY_API_URL }}
run: 'moon ci ${{ matrix.projects }}:staging-dokploy-compose-deploy'