Pārlūkot izejas kodu

Atm/enable cd (#3087)

Signed-off-by: Alex Meijer <alexander.meijer@ibm.com>
Signed-off-by: Alex Meijer <ameijer@users.noreply.github.com>
Alex Meijer 1 gadu atpakaļ
vecāks
revīzija
0cbc471ada

+ 5 - 3
.github/workflows/build-and-publish-develop.yml

@@ -1,9 +1,10 @@
 name: Build and Publish Develop
 
 on:
-  push:
-    branches:
-      - develop
+  workflow_run:
+    workflows: [Build/Test]
+    types: [completed]
+    branches: [develop]
 
 concurrency:
   group: build-opencost-develop
@@ -16,6 +17,7 @@ env:
 jobs:
   build-and-publish-opencost:
     runs-on: ubuntu-latest
+    if: ${{ github.event.workflow_run.conclusion == 'success' }}
     permissions:
       contents: read
       packages: write

+ 42 - 0
.github/workflows/promote-to-demo.yaml

@@ -0,0 +1,42 @@
+name: Promote to Demo
+
+on:
+  workflow_run:
+    workflows: [Build and Publish Develop]
+    types: [completed]
+    branches: [develop]
+
+concurrency:
+  group: build-opencost-develop
+  cancel-in-progress: false
+
+env:
+  # Use docker.io for Docker Hub if empty
+  REGISTRY: ghcr.io
+
+jobs:
+  prep-image-name:
+    runs-on: ubuntu-latest
+    if: ${{ github.event.workflow_run.conclusion == 'success' }}
+    outputs:
+      image_tag: ${{ steps.tags.outputs.IMAGE_TAG }}
+    steps:
+      - name: Checkout Repo
+        uses: actions/checkout@v4
+      - name: Set SHA
+        id: sha
+        run: |
+          echo "OC_SHORTHASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
+
+      - name: Set OpenCost Image Tags
+        id: tags
+        run: |
+          echo "IMAGE_TAG=ghcr.io/${{ github.repository_owner }}/opencost:develop-${{ steps.sha.outputs.OC_SHORTHASH }}" >> $GITHUB_OUTPUT
+ 
+  install-on-demo:
+    needs: [prep-image-name]
+    uses: opencost/opencost-infra/.github/workflows/promote-to-oc-demo.yaml@atm/cd-to-demo
+    secrets: inherit
+    with:
+      image-tag: ${{ needs.prep-image-name.outputs.image_tag }}
+      is_be: true