This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (68 loc) · 1.99 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
name: Deploy
on:
push:
branches: ["master", "dev"]
jobs:
init:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.setvars.outputs.tag }}
stack: ${{ steps.setvars.outputs.stack }}
steps:
- id: setvars
run: |
case "${{ github.ref }}" in
refs/heads/master)
echo "tag=latest" >> $GITHUB_OUTPUT
echo "stack=beabee-demo" >> $GITHUB_OUTPUT
;;
refs/heads/dev)
echo "tag=dev" >> $GITHUB_OUTPUT
echo "stack=beabee-dev" >> $GITHUB_OUTPUT
;;
esac
check:
uses: ./.github/workflows/check.yml
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: cp .env.example .env
- run: npm test
push:
runs-on: ubuntu-latest
needs: [init, check, test]
steps:
- uses: actions/checkout@v3
- id: getrev
run: |
echo "revision=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/build-push-action@v3
with:
push: true
target: app
build-args: |
REVISION=${{ steps.getrev.outputs.revision }}
tags: ${{ secrets.DOCKER_ORGANISATION }}/beabee:${{ needs.init.outputs.tag }}
- uses: docker/build-push-action@v3
with:
push: true
target: router
tags: ${{ secrets.DOCKER_ORGANISATION }}/router:${{ needs.init.outputs.tag }}
deploy:
runs-on: ubuntu-latest
needs: [init, push]
steps:
- uses: jonasschatz/portami@main
with:
endpoint: "https://port.hive.beabee.io"
access_token: ${{ secrets.PORTAINER_ACCESSTOKEN }}
stack_name: ${{ needs.init.outputs.stack }}
prune: true
pull: true