-
Notifications
You must be signed in to change notification settings - Fork 1
150 lines (142 loc) · 4.57 KB
/
deploy.yml
File metadata and controls
150 lines (142 loc) · 4.57 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Build And Tests
on:
push:
pull_request:
branches:
- "main"
- "dev"
jobs:
test:
runs-on: macos-latest
env:
MONGOMS_VERSION: 6.0.5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: 'yarn'
- run: yarn install
- uses: google/wireit@setup-github-actions-caching/v1
- run: MONGOMS_VERSION=6.0.5 yarn test --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: 'yarn'
- run: yarn install
- uses: google/wireit@setup-github-actions-caching/v1
- run: yarn build
env:
NEXT_PUBLIC_APP_ID: ${{ secrets.APP_ID }}
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=sirily11/etd-remote-admin-server
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=latest
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: google/wireit@setup-github-actions-caching/v1
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
APP_ID=${{ secrets.APP_ID }}
PUBLIC_STATS_SERVER=${{secrets.PUBLIC_STATS_SERVER}}
NEXT_PUBLIC_SECRET=${{secrets.NEXT_PUBLIC_SECRET}}
VERSION=${{ steps.prep.outputs.tags }}
pre-release:
runs-on: ubuntu-latest
if: ${{ (github.event.head_commit.author.name != 'github action') && (github.ref == 'refs/heads/dev') }}
needs: [ docker, build ]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: 'yarn'
- run: yarn install
name: Installing dependencies
- name: Setup git identity
run: |
git config --global user.email "github-action.github.com"
git config --global user.name "github action"
- name: Pre-release
run: yarn release --ci --preRelease=beta
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Deploy to GitHub Page
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: k8s-release-dev
folder: example_configs/k8s
release:
runs-on: ubuntu-latest
if: ${{ (github.event.head_commit.author.name != 'github action') && (github.ref == 'refs/heads/main') }}
needs: [ docker, build ]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: 'yarn'
- run: yarn install
name: Installing dependencies
- name: Setup git identity
run: |
git config --global user.email "github-action.github.com"
git config --global user.name "github action"
- name: Pre-release
run: yarn release --ci
env:
GITHUB_TOKEN: ${{secrets.RELEASE_TOKEN}}
- name: Deploy to GitHub Page
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: k8s-release
folder: example_configs/k8s