Skip to content

Commit eb42078

Browse files
committed
ci: automated deployments
1 parent 71ca57f commit eb42078

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Update Environment Tags
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- Build and Push Docker Image
7+
types:
8+
- completed
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
update-tags:
15+
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' }}
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
include:
20+
- name: main
21+
file: environments/main.yaml
22+
- name: test
23+
file: environments/test.yaml
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Set image tag
29+
id: vars
30+
env:
31+
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
32+
run: echo "image_tag=sha-${HEAD_SHA::7}" >> "$GITHUB_OUTPUT"
33+
34+
- name: Update indexer image tag
35+
uses: mikefarah/yq@v4
36+
env:
37+
IMAGE_TAG: ${{ steps.vars.outputs.image_tag }}
38+
with:
39+
cmd: yq -i inplace '.indexer.image.tag = strenv(IMAGE_TAG)' ${{ matrix.file }}
40+
41+
- name: Update query image tag
42+
uses: mikefarah/yq@v4
43+
env:
44+
IMAGE_TAG: ${{ steps.vars.outputs.image_tag }}
45+
with:
46+
cmd: yq -i inplace '.query.image.tag = strenv(IMAGE_TAG)' ${{ matrix.file }}
47+
48+
- name: Commit updated environment tags
49+
uses: stefanzweifel/git-auto-commit-action@v5
50+
with:
51+
commit_message: "chore(cd): update ${{ matrix.name }} image tags to ${{ steps.vars.outputs.image_tag }}"
52+
file_pattern: ${{ matrix.file }}

.github/workflows/docker-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
push:
55
branches:
66
- main
7+
paths:
8+
- src/**
9+
- scripts/**
10+
- Dockerfile
711
release:
812
types: [published, created] # Add 'created' to trigger on release creation
913

0 commit comments

Comments
 (0)