-
Notifications
You must be signed in to change notification settings - Fork 6
114 lines (102 loc) · 3.54 KB
/
Copy pathserver-push.yml
File metadata and controls
114 lines (102 loc) · 3.54 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
name: Master Server Build and Push
on:
push:
branches:
- master
tags:
- "v*"
paths:
- "server/**"
- "fly/**"
- "Cargo.toml"
- "Cargo.lock"
- "Dockerfile"
- ".github/workflows/**"
- "!**/*.md"
jobs:
server-build-and-push:
strategy:
matrix:
include:
- runner: blacksmith-4vcpu-ubuntu-2404
platform: linux/amd64
arch: amd64
- runner: blacksmith-4vcpu-ubuntu-2404-arm
platform: linux/arm64
arch: arm64
runs-on: ${{ matrix.runner }}
steps:
- name: 🏗 Checkout code
uses: actions/checkout@v6
- name: Setup Blacksmith Builder
uses: useblacksmith/setup-docker-builder@v1
- name: 🔐 Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🔐 Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: 🚀 Build and push ${{ matrix.arch }}
uses: useblacksmith/build-push-action@v2
with:
context: .
platforms: ${{ matrix.platform }}
push: true
tags: |
ghcr.io/smolcars/noah-server:latest-${{ matrix.arch }}
${{ secrets.DOCKERHUB_USERNAME }}/noah-server:latest-${{ matrix.arch }}
create-manifest:
needs: server-build-and-push
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: 🔐 Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🔐 Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: 🎯 Create and push multi-arch manifest
run: |
docker buildx imagetools create -t ghcr.io/smolcars/noah-server:latest \
ghcr.io/smolcars/noah-server:latest-amd64 \
ghcr.io/smolcars/noah-server:latest-arm64
docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/noah-server:latest \
${{ secrets.DOCKERHUB_USERNAME }}/noah-server:latest-amd64 \
${{ secrets.DOCKERHUB_USERNAME }}/noah-server:latest-arm64
fly-deploy:
name: Deploy to Fly
needs: create-manifest
runs-on: blacksmith-4vcpu-ubuntu-2404
concurrency: deploy-group
steps:
- uses: actions/checkout@v6
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --config fly/signet.fly.toml --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_SIGNET_API_TOKEN }}
mainnet-fly-deploy:
name: Deploy mainnet to Fly
needs: fly-deploy
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: blacksmith-4vcpu-ubuntu-2404
environment: production
concurrency: fly-mainnet-deploy
steps:
- uses: actions/checkout@v6
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl config validate --strict --config fly/mainnet.fly.toml
env:
FLY_API_TOKEN: ${{ secrets.FLY_MAINNET_API_TOKEN }}
- run: flyctl deploy --config fly/mainnet.fly.toml --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_MAINNET_API_TOKEN }}