-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (127 loc) · 4.19 KB
/
publish.yml
File metadata and controls
133 lines (127 loc) · 4.19 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
name: Build and Publish Docker Image
on:
push:
branches:
- 'main'
jobs:
html:
name: Static HTML Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install Dependencies
working-directory: html
run: npm ci --production
- name: Build html
working-directory: html
run: npm run build
- name: Upload HTML artifacts
uses: actions/upload-artifact@v3
with:
name: html
path: "./html/build"
x86_64-unknown-linux-musl:
name: Linux x86_64
runs-on: ubuntu-latest
needs: [html]
steps:
- uses: actions/checkout@v2
- name: Download HTML artifacts
uses: actions/download-artifact@v3
with:
name: html
path: "./html/build"
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target x86_64-unknown-linux-musl --bins --release
- name: Rename binaries
run: mv target/x86_64-unknown-linux-musl/release/message-queuing message-queuing_amd64 && mv target/x86_64-unknown-linux-musl/release/bot-commands bot-commands_amd64 && mv target/x86_64-unknown-linux-musl/release/bot-consumer bot-consumer_amd64 && mv target/x86_64-unknown-linux-musl/release/webserver webserver_amd64
- name: Upload AMD64 binaries
uses: actions/upload-artifact@v3
with:
name: amd64
path: "*_amd64"
aarch64-unknown-linux-musl:
name: Linux ARM64
runs-on: ubuntu-latest
needs: [html]
steps:
- uses: actions/checkout@v2
- name: Download HTML artifacts
uses: actions/download-artifact@v3
with:
name: html
path: "./html/build"
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-unknown-linux-musl
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target aarch64-unknown-linux-musl --bins --release
- name: Rename binaries
run: mv target/aarch64-unknown-linux-musl/release/message-queuing message-queuing_arm64 && mv target/aarch64-unknown-linux-musl/release/bot-commands bot-commands_arm64 && mv target/aarch64-unknown-linux-musl/release/bot-consumer bot-consumer_arm64 && mv target/aarch64-unknown-linux-musl/release/webserver webserver_arm64
- name: Upload ARM64 binaries
uses: actions/upload-artifact@v3
with:
name: arm64
path: "*_arm64"
docker:
name: Docker Image
runs-on: ubuntu-latest
needs: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Download AMD64 binaries
uses: actions/download-artifact@v3
with:
name: amd64
- name: Download ARM64 binaries
uses: actions/download-artifact@v3
with:
name: arm64
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: marnixjanssen/telgram-pepperbot:latest
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [docker]
steps:
- name: Deploy to Kubernetes
shell: bash
env:
DEPLOY_URL: ${{ secrets.DEPLOY_URL }}
DEPLOY_NAMESPACE: ${{ secrets.DEPLOY_NAMESPACE }}
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
run: |
curl --header "Authorization: Bearer $DEPLOY_TOKEN" "$DEPLOY_URL/deployment/$DEPLOY_NAMESPACE"