Skip to content

Commit 725c1f1

Browse files
authored
Merge pull request bitcoin-dev-project#375 from willcl-ark/ci-target-branch
2 parents cab0be3 + c84b643 commit 725c1f1

File tree

2 files changed

+64
-54
lines changed

2 files changed

+64
-54
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

.github/workflows/test.yml

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: test
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
push:
66
branches:
77
- main
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- uses: chartboost/ruff-action@v1
15-
build:
15+
build-image:
1616
needs: [ruff]
1717
runs-on: ubuntu-latest
1818
steps:
@@ -38,7 +38,7 @@ jobs:
3838
name: warnet
3939
path: /tmp/warnet.tar
4040
test:
41-
needs: [build]
41+
needs: [build-image]
4242
runs-on: ubuntu-latest
4343
strategy:
4444
matrix:
@@ -56,59 +56,9 @@ jobs:
5656
- name: Run tests
5757
run: ./test/${{matrix.test}} ${{matrix.backend}}
5858
build-test:
59-
needs: [build, test]
59+
needs: [build-image]
6060
runs-on: ubuntu-latest
6161
steps:
6262
- uses: actions/checkout@v4
6363
- uses: ./.github/actions/compose
6464
- run: ./test/build_branch_test.py compose
65-
deploy:
66-
needs: [build-test]
67-
runs-on: ubuntu-latest
68-
steps:
69-
- uses: actions/checkout@v4
70-
- name: Set up QEMU
71-
uses: docker/setup-qemu-action@v3
72-
- name: Set up Docker Buildx
73-
uses: docker/setup-buildx-action@v3
74-
- name: Docker meta
75-
id: meta
76-
uses: docker/metadata-action@v5
77-
with:
78-
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_RPC_REPO }}
79-
tags: |
80-
type=ref,event=tag
81-
type=ref,event=pr
82-
type=raw,value=latest,enable={{is_default_branch}}
83-
labels: |
84-
maintainer=bitcoindevproject
85-
org.opencontainers.image.title=warnet-rpc
86-
org.opencontainers.image.description=Warnet RPC server
87-
- name: Login to Docker Hub
88-
uses: docker/login-action@v3
89-
with:
90-
username: ${{ secrets.DOCKERHUB_USERNAME }}
91-
password: ${{ secrets.DOCKERHUB_TOKEN }}
92-
- name: Build and push production RPC image
93-
uses: docker/build-push-action@v5
94-
with:
95-
file: src/templates/rpc/Dockerfile_rpc
96-
platforms: linux/amd64,linux/arm64
97-
context: .
98-
push: true
99-
tags: ${{ steps.meta.outputs.tags }}
100-
labels: ${{ steps.meta.outputs.labels }}
101-
cache-from: type=gha
102-
cache-to: type=gha,mode=max
103-
- name: Build and push dev RPC image
104-
if: github.ref == 'refs/heads/main'
105-
uses: docker/build-push-action@v5
106-
with:
107-
file: src/templates/rpc/Dockerfile_rpc_dev
108-
platforms: linux/amd64,linux/arm64
109-
context: .
110-
push: true
111-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_RPC_REPO }}:dev
112-
labels: ${{ steps.meta.outputs.labels }}
113-
cache-from: type=gha
114-
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)