-
Notifications
You must be signed in to change notification settings - Fork 22
81 lines (73 loc) · 2.87 KB
/
dapp-build.yml
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: "DApp Build"
on:
workflow_call:
inputs:
network:
required: true
type: string
outputs:
dapp-image:
description: "The DApp built container image"
value: ${{ jobs.build_package.outputs.dapp-image }}
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true
jobs:
build_package:
runs-on: ubuntu-22.04
outputs:
dapp-image: ${{ steps.set-dapp-image.outputs.dapp-image }}
steps:
- uses: actions/checkout@v3
# Add support for more platforms with QEMU (necessary to run RISC-V containers)
- 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:
bake-target: server
images: |
name=ghcr.io/cartesi/honeypot
name=docker.io/cartesi/honeypot,enable=${{ github.event_name != 'pull_request' }}
tags: |
type=semver,pattern={{version}},suffix=-server-${{inputs.network}}
type=ref,event=branch,pattern={{branch}},suffix=-server-${{inputs.network}}
type=ref,event=pr,pattern=${{ github.event.number }},suffix=-server-${{inputs.network}}
flavor: latest=false
- name: Set dapp-image
id: set-dapp-image
run: |
export version=${{ steps.meta.outputs.version }}
echo ::set-output name=dapp-image::ghcr.io/cartesi/honeypot:$version
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
id: build
uses: docker/bake-action@v2
with:
workdir: ./
push: true
targets: server
files: |
docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
*.args.NETWORK=${{inputs.network}}