-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate infra code to ai-validation-infra and write deploy Github act… (
#56)
- Loading branch information
Showing
6 changed files
with
61 additions
and
80 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: deploy | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["build"] | ||
types: | ||
- completed | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get GHCR package hash | ||
id: get_package_hash | ||
run: | | ||
container_id=$(gh api --paginate -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/MinBZK/packages/container/ai-act-beslisboom/versions | jq -r '.[] | select(.metadata.container.tags | contains(["main"])) | .name') | ||
echo "container_id=$container_id" >> "$GITHUB_OUTPUT" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: check correct name | ||
run: | | ||
if [ -z "${{steps.get_package_hash.outputs.container_id}}" ]; then | ||
echo "Variable is empty. Failing the workflow." | ||
exit 1 | ||
fi | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: 'minbzk/ai-validation-infra' | ||
ref: main | ||
token: ${{ secrets.GH_PAT }} | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
- name: Make changes to the file | ||
run: | | ||
sed -i 's/newTag: .*$/newTag: main@${{ steps.get_package_hash.outputs.container_id }}/g' apps/ai-act-beslisboom/sandbox/kustomization.yaml | ||
sed -i 's|minbzk.github.io/version: .*$|minbzk.github.io/version: main|g' apps/ai-act-beslisboom/sandbox/kustomization.yaml | ||
git add apps/ai-act-beslisboom/sandbox/kustomization.yaml | ||
- name: show changes | ||
run: git diff --staged | ||
|
||
- name: push changes | ||
run: | | ||
git commit -m "Update ai-act-beslisboom sandbox tag ${{ steps.get_package_hash.outputs.container_id }}" | ||
git push --force-with-lease | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT }} |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.