2022-03-02 01:00:55 -08:00
|
|
|
name: zcash-lightwalletd
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2022-06-01 04:36:59 -07:00
|
|
|
|
|
|
|
# Update the lightwalletd image when related changes merge to the `zebra/main` branch
|
2022-03-02 01:00:55 -08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
paths:
|
2022-03-03 05:03:06 -08:00
|
|
|
# rebuild lightwalletd whenever the related Zebra code changes
|
|
|
|
#
|
|
|
|
# TODO: this code isn't compiled in this docker image
|
2022-06-13 13:13:30 -07:00
|
|
|
# rebuild whenever the actual code at lightwalletd/master changes
|
2022-03-02 01:00:55 -08:00
|
|
|
- 'zebra-rpc/**'
|
|
|
|
- 'zebrad/tests/acceptance.rs'
|
|
|
|
- 'zebrad/src/config.rs'
|
|
|
|
- 'zebrad/src/commands/start.rs'
|
2022-05-13 08:20:17 -07:00
|
|
|
# these workflow definitions actually change the docker image
|
|
|
|
- 'docker/zcash-lightwalletd/Dockerfile'
|
|
|
|
- '.github/workflows/zcash-lightwalletd.yml'
|
|
|
|
|
|
|
|
# Update the lightwalletd image when each related PR changes
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
# rebuild lightwalletd whenever the related Zebra code changes
|
|
|
|
# (this code isn't actually compiled in this docker image)
|
|
|
|
- 'zebra-rpc/**'
|
|
|
|
- 'zebrad/tests/acceptance.rs'
|
|
|
|
- 'zebrad/src/config.rs'
|
|
|
|
- 'zebrad/src/commands/start.rs'
|
|
|
|
# these workflow definitions actually change the docker image
|
2022-03-02 01:00:55 -08:00
|
|
|
- 'docker/zcash-lightwalletd/Dockerfile'
|
|
|
|
- '.github/workflows/zcash-lightwalletd.yml'
|
|
|
|
|
|
|
|
env:
|
2022-03-18 14:25:35 -07:00
|
|
|
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
2022-03-02 01:00:55 -08:00
|
|
|
IMAGE_NAME: lightwalletd
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build images
|
|
|
|
runs-on: ubuntu-latest
|
2022-03-18 14:25:35 -07:00
|
|
|
permissions:
|
|
|
|
contents: 'read'
|
|
|
|
id-token: 'write'
|
2022-03-02 01:00:55 -08:00
|
|
|
|
|
|
|
steps:
|
2022-04-21 20:00:02 -07:00
|
|
|
- uses: actions/checkout@v3.0.2
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
2022-06-13 13:13:30 -07:00
|
|
|
repository: adityapk00/lightwalletd
|
2022-05-15 20:16:10 -07:00
|
|
|
ref: 'master'
|
2022-04-11 22:06:37 -07:00
|
|
|
persist-credentials: false
|
2022-03-02 01:00:55 -08:00
|
|
|
|
2022-04-21 20:00:02 -07:00
|
|
|
- uses: actions/checkout@v3.0.2
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
path: zebra
|
|
|
|
persist-credentials: false
|
2022-03-02 01:00:55 -08:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Inject slug/short variables
|
|
|
|
uses: rlespinasse/github-slug-action@v4
|
|
|
|
with:
|
|
|
|
short-length: 7
|
2022-03-02 01:00:55 -08:00
|
|
|
|
2022-03-03 22:33:29 -08:00
|
|
|
# Automatic tag management and OCI Image Format Specification for labels
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
2022-05-06 07:06:13 -07:00
|
|
|
uses: docker/metadata-action@v4.0.1
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
# list of Docker images to use as base name for tags
|
|
|
|
images: |
|
|
|
|
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}
|
|
|
|
# generate Docker tags based on the following events/attributes
|
2022-06-13 14:38:18 -07:00
|
|
|
# set latest tag for default branch
|
2022-04-11 22:06:37 -07:00
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
type=sha
|
2022-06-13 14:38:18 -07:00
|
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
2022-03-03 22:33:29 -08:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Set up QEMU
|
|
|
|
id: qemu
|
2022-05-06 08:37:46 -07:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
image: tonistiigi/binfmt:latest
|
|
|
|
platforms: all
|
2022-03-02 16:39:41 -08:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
# Setup Docker Buildx to allow use of docker cache layers from GH
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2022-05-06 08:37:06 -07:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-03-02 01:00:55 -08:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
# Setup gcloud CLI
|
|
|
|
- name: Authenticate to Google Cloud
|
|
|
|
id: auth
|
2022-05-24 12:16:18 -07:00
|
|
|
uses: google-github-actions/auth@v0.8.0
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
workload_identity_provider: 'projects/143793276228/locations/global/workloadIdentityPools/github-actions/providers/github-oidc'
|
|
|
|
service_account: 'github-service-account@zealous-zebra.iam.gserviceaccount.com'
|
|
|
|
token_format: 'access_token'
|
2022-03-18 14:25:35 -07:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
- name: Login to Google Artifact Registry
|
2022-05-06 08:37:37 -07:00
|
|
|
uses: docker/login-action@v2.0.0
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
registry: us-docker.pkg.dev
|
|
|
|
username: oauth2accesstoken
|
|
|
|
password: ${{ steps.auth.outputs.access_token }}
|
2022-03-02 01:00:55 -08:00
|
|
|
|
2022-04-11 22:06:37 -07:00
|
|
|
# Build and push image to Google Artifact Registry
|
|
|
|
- name: Build & push
|
|
|
|
id: docker_build
|
2022-05-06 08:37:22 -07:00
|
|
|
uses: docker/build-push-action@v3.0.0
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
target: build
|
|
|
|
context: .
|
|
|
|
file: ./zebra/docker/zcash-lightwalletd/Dockerfile
|
|
|
|
platforms: |
|
|
|
|
linux/amd64
|
|
|
|
linux/arm64
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
push: true
|
|
|
|
cache-from: type=registry,ref=${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:buildcache
|
|
|
|
cache-to: type=registry,ref=${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
|