-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (48 loc) · 1.77 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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Deploy to HBI
on:
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
name: "Build Image"
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v3
- name: Inject config
run: echo "$APPSETTINGS_CONTENT" > JournalyApiV2/appsettings.json
env:
APPSETTINGS_CONTENT: ${{ secrets.APPSETTINGS }}
- uses: docker/setup-buildx-action@v2
- run: docker login -u "${{ secrets.REGISTRY_USERNAME }}" -p "${{ secrets.REGISTRY_PASSWORD }}" ${{ secrets.REGISTRY_ADDRESS }}
- uses: docker/build-push-action@v4
with:
context: .
file: ./JournalyApiV2/Dockerfile
platforms: linux/amd64
push: false
load: true
tags: ${{ secrets.REGISTRY_ADDRESS }}/journalyapi:latest
- run: |
mkdir -p $HOME/docker-image
docker save -o $HOME/docker-image/image.tar ${{ secrets.REGISTRY_ADDRESS }}/journalyapi:latest
push:
name: "Push Image"
needs: [build]
runs-on: [self-hosted, linux]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Load Docker image
run: docker load -i $HOME/docker-image/image.tar
- name: Login to HBI Container Registry
run: docker login -u "${{ secrets.REGISTRY_USERNAME }}" -p "${{ secrets.REGISTRY_PASSWORD }}" ${{ secrets.REGISTRY_ADDRESS }}
- name: Push
run: docker push ${{ secrets.REGISTRY_ADDRESS }}/journalyapi:latest
- name: Deploy to HBI Server
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.WEBHOOK }}
method: 'POST'