Skip to content

Publish rmoa cli (#246) #1

Publish rmoa cli (#246)

Publish rmoa cli (#246) #1

name: Release Service
on:
push:
branches: [main]
workflow_dispatch:
jobs:
release:
name: Release Service
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' # This can only be triggered from main
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- id: auth-gcp
uses: "google-github-actions/auth@v2"
with:
token_format: "access_token"
workload_identity_provider: "projects/196494084534/locations/global/workloadIdentityPools/github-actions-wi-pool/providers/github-actions-wi-provider"
service_account: "[email protected]"
access_token_lifetime: "300s"
- name: Login to Google Registry
uses: docker/login-action@v2
with:
registry: us-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth-gcp.outputs.access_token }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
us-docker.pkg.dev/zuplo-marketing/docker-registry/rate-my-openapi-api
tags: |
type=raw,value=latest
type=ref,event=branch
type=sha,format=long
- name: Build and Push Image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.api
platforms: linux/amd64
push: true
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
NODE_AUTH_TOKEN=${{ secrets.GH_NPM_PACKAGE_READ_TOKEN }}
- uses: google-github-actions/deploy-cloudrun@v1
with:
service: rate-my-openapi
image: us-docker.pkg.dev/zuplo-marketing/docker-registry/rate-my-openapi-api:latest