-
Notifications
You must be signed in to change notification settings - Fork 8
89 lines (82 loc) · 3.07 KB
/
sdk.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
name: sdk
on:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
pull_request:
paths:
- .github/workflows/sdk.yaml
- packages/sdk/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
permissions:
contents: read
packages: write
id-token: write
actions: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get package tag/version
id: package-version
if: ${{ github.event_name == 'push' }}
run: |
jq -r '"PACKAGE_VERSION=\(.version)"' packages/sdk/package.json >> "$GITHUB_OUTPUT"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
docker.io/cartesi/sdk,enable=${{ github.event_name != 'pull_request' }}
ghcr.io/cartesi/sdk
tags: |
type=raw,value=${{ steps.package-version.outputs.PACKAGE_VERSION }},enable=${{ github.event_name == 'push' }}
type=ref,event=pr
labels: |
org.opencontainers.image.title=Cartesi SDK
org.opencontainers.image.description=Cartesi SDK tools image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/bake-action@v5
if: ${{ !startsWith(github.ref, 'refs/tags/sdk@') }}
with:
workdir: packages/sdk
files: |
./docker-bake.hcl
./docker-bake.platforms.hcl
${{ steps.meta.outputs.bake-file }}
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
push: true
- uses: depot/setup-action@v1
- name: Build and push (depot)
uses: depot/bake-action@v1
if: ${{ startsWith(github.ref, 'refs/tags/sdk@') }}
with:
project: ${{ vars.DEPOT_PROJECT }}
workdir: packages/sdk
files: |
./docker-bake.hcl
./docker-bake.platforms.hcl
${{ steps.meta.outputs.bake-file }}
push: true