Skip to content

Change image tagging #8

Change image tagging

Change image tagging #8

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 23 * * *'
push:
branches:
- 'feat-*'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
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 "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 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
- 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 }}"}'