CD #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
on: | |
workflow_run: | |
workflows: [CI] | |
branches: [staging, production] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ github.event.workflow_run.head_branch }}' | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=raw,value=${{ github.event.workflow_run.head_branch }} | |
type=sha | |
- id: build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
load: true | |
cache-from: type=gha,scope=discordbot | |
cache-to: type=gha,mode=max,scope=discordbot | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
xtp: | |
runs-on: ubuntu-latest | |
env: | |
XTP_TOKEN: ${{ secrets.XTP_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ github.event.workflow_run.head_branch }}' | |
- name: update the schema | |
run: | | |
if [ "${{ github.event.workflow_run.head_branch }}" = "production" ]; then | |
EXTENSION_ID=ext_01j8r4jqawfd6tjxh85t3988kc | |
else | |
EXTENSION_ID=ext_01j94w8hekf6ssv2thqs8sh8v0 | |
fi | |
body="$(jq -rcM -n --arg content "$(cat plugin.yaml)" '{"name":"chat", "schema": $content}')" | |
curl -sLfi \ | |
-H "Authorization: Bearer $XTP_TOKEN" \ | |
-H "content-type: application/json" \ | |
-X PUT -d "$body" \ | |
'https://xtp.dylibso.com/api/v1/extension-points/'$EXTENSION_ID | |
northflank: | |
runs-on: ubuntu-latest | |
needs: [build, xtp] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ github.event.workflow_run.head_branch }}' | |
- name: Trigger release flow | |
run: | | |
if [ "${{ github.event.workflow_run.head_branch }}" = "production" ]; then | |
WEBHOOK=${{ secrets.NF_WEBHOOK_PRODUCTION }} | |
else | |
WEBHOOK=${{ secrets.NF_WEBHOOK_STAGING }} | |
fi | |
curl -X GET "${WEBHOOK}?image_tag=$(git rev-parse HEAD)" |