-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (84 loc) · 2.56 KB
/
ghcr.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
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
name: Next Application Build, Push, and Deploy
on:
push:
branches:
- "main"
- "support-pali-v1-backward-compatibility"
jobs:
docker:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/syscoin/syscoin-bridge
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Write metadata
run: "cp $DOCKER_METADATA_OUTPUT_BAKE_FILE metadata.json"
- name: Save metadata
uses: actions/upload-artifact@v4
with:
name: metadata
path: metadata.json
deploy-staging:
needs: docker
environment:
name: staging
permissions:
deployments: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Download metadata
uses: actions/download-artifact@v4
with:
name: metadata
path: ./metadata
- name: Read Metadata
id: read-metadata
run: |
cd metadata
meta=$(cat metadata.json)
echo "::set-output name=tags::$(echo "$meta" | jq -r '.target["docker-metadata-action"].tags | join(",")')"
shell: bash
- name: Deploy Frontend Service
uses: appleboy/[email protected]
env:
IMAGE_TAG: ${{ steps.read-metadata.outputs.tags }}
with:
host: ${{ secrets.HETZNER_STAGING_HOST }}
username: root
key: ${{ secrets.HETZNER_SSH_KEY }}
script: |
export FRONTEND_IMAGE="$(echo ${{ env.IMAGE_TAG }} | cut -d ',' -f 2)"
cd /root/bridge
docker-compose pull frontend
docker-compose up -d frontend