initial commit #1
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: Build Data Source Container | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['main'] | |
paths: | |
- 'blogs/**' | |
- 'dataFeeder/**' | |
# workflow_run: | |
# workflows: ["Save Tokens to Azure KV"] | |
# branches: [main] | |
# types: | |
# - completed | |
# pull_request: | |
# branches: ['main'] | |
jobs: | |
# ------------------------------------------ job 1 | |
build-data-sources: | |
runs-on: ubuntu-latest | |
outputs: | |
newtag: ${{ steps.export_tag.outputs.sha }} | |
shorttag: ${{ steps.export_tag.outputs.short }} | |
steps: | |
- name: Export sha as short tag | |
id: export_tag | |
run: | | |
export "SHA=${{ github.sha }}" | |
echo $SHA | |
echo "${SHA:0:7}" | |
export "SHORT=${SHA:0:7}" | |
echo "sha=${{github.sha}}" >> $GITHUB_OUTPUT | |
echo "short=${SHORT}" >> $GITHUB_OUTPUT | |
- name: Build, Tag and Push Docker Image to GHCR | |
uses: GlueOps/[email protected] | |
with: | |
# inputs are ['github_token', 'image_name', 'dockerfile-path', 'context', 'registry', 'registry-username', 'tags'] | |
dockerfile: ./Dockerfile-dataFeeder | |
image_name: ghcr.io/xgeekshq/xgeeks-ai-starter-demo-datafeeder | |
# ------------------------------------------ job 2 | |
update-deployed-data-container-tag: | |
runs-on: ubuntu-latest | |
needs: build-data-sources | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
repository: xgeekshq/xgeeks-ai-starter-demo_deployment | |
token: ${{ secrets.IDP_TOKEN }} | |
- name: Install Kustomize | |
uses: imranismail/setup-kustomize@v2 | |
- name: Kustomize deployment image tag | |
env: | |
NEW_TAG: ${{ needs.build-data-sources.outputs.newtag }} | |
SHORT_TAG: ${{ needs.build-data-sources.outputs.shorttag }} | |
run: | | |
cd k8s/overlays/dev | |
echo $NEW_TAG | |
echo $SHORT_TAG | |
kustomize edit set image ghcr.io/xgeekshq/xgeeks-ai-starter-demo-datafeeder:${{ env.SHORT_TAG }} | |
git config --local user.email "[email protected]" | |
git config --local user.name "CD Action" | |
git add . | |
git commit -m "ci: update 'xgeeks-ai-starter-demo-datafeeder' image tag to '${{ env.SHORT_TAG }}' " | |
git push |