This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (52 loc) · 1.74 KB
/
docker-ci.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
name: Publish to GHCR
on:
push:
tags:
- 'v*'
permissions:
packages: write
env:
CARGO_TERM_COLOR: always
jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [amd64, arm64]
include:
- architecture: amd64
target: x86_64-unknown-linux-gnu
- architecture: arm64
target: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- name: Check architecture
id: arch-check
run: echo "Architecture is ${{ matrix.architecture }}"
- name: Build Docker image
if: ${{ matrix.architecture == 'amd64' }}
run: |
TAG=${{ github.ref_name }}
docker build --build-arg TARGET=${{ matrix.target }} -t ghcr.io/tkbstudios/netchat-server-rust/netchat-server:${TAG} -t ghcr.io/tkbstudios/netchat-server-rust/netchat-server:latest .
- name: Log in to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
if: ${{ matrix.architecture == 'amd64' }}
run: |
TAG=${{ github.ref_name }}
docker push ghcr.io/tkbstudios/netchat-server-rust/netchat-server:${TAG}
docker push ghcr.io/tkbstudios/netchat-server-rust/netchat-server:latest
- name: Skip aarch64 build
if: ${{ matrix.architecture == 'arm64' }}
run: echo "Skipping build for aarch64"