Skip to content

Commit c84b643

Browse files
committed
add deploy.yml, run on:workflow
1 parent 90ec340 commit c84b643

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: deploy
2+
3+
on:
4+
workflow_run:
5+
workflows: ["test"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
deploy-to-dockerhub:
11+
runs-on: ubuntu-latest
12+
if: >
13+
github.event.workflow_run.conclusion == 'success'
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v3
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
- name: Docker meta
21+
id: meta
22+
uses: docker/metadata-action@v5
23+
with:
24+
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_RPC_REPO }}
25+
tags: |
26+
type=ref,event=tag
27+
type=ref,event=pr
28+
type=raw,value=latest,enable={{is_default_branch}}
29+
labels: |
30+
maintainer=bitcoindevproject
31+
org.opencontainers.image.title=warnet-rpc
32+
org.opencontainers.image.description=Warnet RPC server
33+
- name: Login to Docker Hub
34+
uses: docker/login-action@v3
35+
with:
36+
username: ${{ secrets.DOCKERHUB_USERNAME }}
37+
password: ${{ secrets.DOCKERHUB_TOKEN }}
38+
- name: Build and push production RPC image
39+
uses: docker/build-push-action@v5
40+
with:
41+
file: src/templates/rpc/Dockerfile_rpc
42+
platforms: linux/amd64,linux/arm64
43+
context: .
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+
cache-from: type=gha
48+
cache-to: type=gha,mode=max
49+
- name: Build and push dev RPC image
50+
if: github.ref == 'refs/heads/main'
51+
uses: docker/build-push-action@v5
52+
with:
53+
file: src/templates/rpc/Dockerfile_rpc_dev
54+
platforms: linux/amd64,linux/arm64
55+
context: .
56+
push: true
57+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_RPC_REPO }}:dev
58+
labels: ${{ steps.meta.outputs.labels }}
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)