Feature/add hl graphql to sdk #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |