Skip to content
name: Build Flowforge container
on:
workflow_dispatch:
inputs:
flowforge_release_name:
description: 'flowforge package version'
required: false
default: 'nightly'
flowforge_ref:
description: 'flowforge package ref'
required: false
schedule:
- cron: '30 5 * * *'
push:
branches:
- 'feat-*'
pull_request:
branches:
- main
jobs:
build:
if: true
uses: flowforge/github-actions-workflows/.github/workflows/build_container_image.yml@feat-container-build
with:
image_name: 'forge-k8s'
package_dependencies: |
@flowforge/flowforge
@flowforge/kubernetes
build_context: 'flowforge-container'
npm_registry_url: ${{ vars.PRIVATE_NPM_REGISTRY_URL }}
push_image: false
secrets:
npm_registry_auth_token: ${{ secrets.GITHUB_TOKEN }}
directBuild:
runs-on: ubuntu-latest
if: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Set release name and image tag
# if: ${{ github.event_name == 'schedule' }}
run: |
echo "release_name=nightly" >> $GITHUB_ENV
echo "npm_registry=https://npm.pkg.github.com" >> $GITHUB_ENV
echo "image_tag=nightly-$(date +%Y%m%d%H%m%S)" >> $GITHUB_ENV
- name: "Set dependencies versions"
run: |
cat flowforge-container/package.json | jq '.dependencies["@flowforge/flowforge"] = "${{ env.release_name }}" | .dependencies["@flowforge/kubernetes"] = "${{ env.release_name }}" ' > flowforge-container/package.json-patched
mv flowforge-container/package.json-patched flowforge-container/package.json
# - name: Configure AWS credentials
# if: ${{ env.release_name == 'nightly' }}
# uses: aws-actions/configure-aws-credentials@v2
# with:
# aws-access-key-id: ${{ secrets.STAGING_AWS_ID }}
# aws-secret-access-key: ${{ secrets.STAGING_AWS_KEY }}
# aws-region: eu-west-1
# - name: "Login to Staging ECR"
# if: ${{ env.release_name == 'nightly' }}
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
# - name: Get image metadata
# id: image_metadata
# uses: docker/metadata-action@v4
# with:
# images: |
# ${{ steps.login-ecr.outputs.registry }}/flowforge/forge-k8s
# tags: |
# type=raw,value=${{ env.image_tag }}
# flavor: |
# latest=false
- name: Build container image
uses: docker/build-push-action@v4
with:
context: flowforge-container
file: flowforge-container/Dockerfile
tags: "forge-k8s:${{ env.image_tag }}"
platforms: |
linux/amd64
linux/arm64
build-args: |
REGISTRY=${{ env.npm_registry }}
REGISTRY_TOKEN=${{ secrets.GITHUB_TOKEN }}
push: false
# - name: Build and push Forge container
# uses: docker/[email protected]
# with:
# context: flowforge-container
# file: flowforge-container/Dockerfile
# tags: ${{ steps.image_metadata.outputs.tags }}
# platforms: |
# linux/amd64
# linux/arm64
# build-args: |
# REGISTRY=npm.pkg.github.com
# REGISTRY_TOKEN=${{ secrets.GITHUB_TOKEN }}
# push: true
dispatch:
runs-on: ubuntu-latest
needs: [build]
if: false
steps:
- name: Generate a token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.GH_BOT_APP_ID }}
private_key: ${{ secrets.GH_BOT_APP_KEY }}
- name: Trigger cloud deployment
uses: benc-uk/workflow-dispatch@v1
with:
workflow: deploy.yml
repo: flowforge/CloudProject
ref: feat-deployment-poc
token: ${{ steps.generate_token.outputs.token }}
inputs: '{"flowforge_image_tag": "${{ env.image_tag }}"}'