-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (56 loc) · 2 KB
/
deployment.yaml
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
name: Deployment pipeline
on: push
jobs:
deployment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set env
run: |
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
echo "${{ vars.PROD_ENV }}" > .env
elif [[ ${{ github.ref }} == 'refs/heads/stage' ]]; then
echo "${{ vars.STAGE_ENV }}" > .env
elif [[ ${{ github.ref }} == 'refs/heads/test' ]]; then
echo "${{ vars.TEST_ENV }}" > .env
elif [[ ${{ github.ref }} == 'refs/heads/develop' ]]; then
echo "${{ vars.DEV_ENV }}" > .env
else
echo "${{ vars.PLAYGROUND_ENV }}" > .env
fi
echo "VITE_GIT_COMMIT=${GITHUB_REF##*/}${{ github.sha }}" >> .env
- name: Load .env file
uses: xom9ikk/dotenv@v2
- uses: oven-sh/setup-bun@v1
- name: Install
run: bun install
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up app for hosting
run: |
base_name=${{ env.VITE_BASE_NAME }}
port=${{ env.VITE_PORT }}
sed -i.bak "s|\"homepage\": \".*\"|\"homepage\": \"$base_name\"|" package.json
sed -i.bak "s|<base href=\"\\/\" \\/>|<base href=\"$base_name\" \\/>|" src/index.html
sed -i.bak "s/8080/$port/" Dockerfile
- name: Build
run: bun run build
- name: Docker build and push
run: |
docker build -t cphcachet/carp-portal:${{ env.TAG }} .
docker push cphcachet/carp-portal:${{ env.TAG }}
- name: Microsoft Teams Deploy Card
if: always()
uses: toko-bifrost/ms-teams-deploy-card@master
with:
github-token: ${{ github.token }}
webhook-uri: ${{ secrets.TEAMS_WEBHOOK_URL }}
show-on-start: false
show-on-exit: true
envirnment: ${{ github.ref }}
card-layout-exit: cozy
timezone: Europe/Copenhagen