Skip to content

feat(deploy): gcp

feat(deploy): gcp #506

# build and push docker image to docker hub
name: Build & Deploy
on:
push:
branches:
- "main"
tags:
- "v*"
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: flosspicks/crossbell-io
tags: |
type=sha
type=sha,format=long
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: pnpm/action-setup@v2
with:
version: latest
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
- run: pnpm fetch && pnpm install -r --offline
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy-dev:
if: github.ref == 'refs/heads/main'
uses: NaturalSelectionLabs/Daedalus/.github/workflows/deploy-v3-tpl.yaml@main
needs:
- build
with:
images: flosspicks/crossbell-io
tag: sha-${{ github.sha }}
cluster: dev
namespace: crossbell
releaseName: xfeed
revision: main
dir: deploy/dev
secrets:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
deploy-prod:
if: startsWith(github.ref, 'refs/tags/v')
uses: NaturalSelectionLabs/Daedalus/.github/workflows/deploy-v3-tpl.yaml@main
needs:
- build
with:
images: flosspicks/crossbell-io
tag: sha-${{ github.sha }}
cluster: prod
namespace: crossbell
releaseName: xfeed
revision: main
dir: deploy/prod
secrets:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}