This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
108 lines (92 loc) · 2.79 KB
/
ci.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
name: Continuous Integration
on:
pull_request:
branches: ['**']
push:
branches: ['main']
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Java (temurin@17)
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: sbt
- name: Check that scalafmt has been run
run: sbt 'all scalafmtSbtCheck scalafmtCheckAll'
- name: Check that scalafix has been run
run: sbt 'scalafixAll --check'
- name: Build project
run: sbt test helios/Docker/stage
- name: Compress target directories
run: tar cf targets.tar target helios/target project/target
- name: Upload target directories
uses: actions/upload-artifact@v3
with:
name: target
path: targets.tar
publish:
name: Publish Artifacts
needs: [build]
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- name: Download target directories
uses: actions/download-artifact@v3
with:
name: target
- name: Inflate target directories
run: |
tar xf targets.tar
rm targets.tar
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/dhpiggott/helios
tags: |
type=sha
- name: Build and push
uses: docker/build-push-action@v3
with:
cache-from: type=gha
tags: ${{ steps.meta.outputs.tags }}
context: helios/target/docker/stage
push: true
platforms: linux/amd64, linux/arm64
cache-to: type=gha,mode=max
deploy:
name: Deploy to production
needs: [publish]
uses: ./.github/workflows/cd.yml
with:
environment: production
version: ${{ needs.publish.outputs.version }}
secrets:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
HOST: ${{ secrets.HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
BRIDGE_API_KEY: ${{ secrets.BRIDGE_API_KEY }}
BRIDGE_IP_ADDRESS: ${{ secrets.BRIDGE_IP_ADDRESS }}
HOME_LATITUDE: ${{ secrets.HOME_LATITUDE }}
HOME_LONGITUDE: ${{ secrets.HOME_LONGITUDE }}
TIME_ZONE: ${{ secrets.TIME_ZONE }}