-
Notifications
You must be signed in to change notification settings - Fork 120
56 lines (54 loc) · 1.96 KB
/
release-to-main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Release to main
on:
workflow_dispatch:
pull_request:
branches:
- dev
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
environment: build
steps:
- uses: actions/checkout@v4
with:
ref: dev
- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Retag images
run: |
az acr login -n ${{ secrets.ACR_NAME }}
for service in api-orchestrator worker cache; do
export SERVICE_TAG=${{ secrets.ACR_NAME }}.azurecr.io/unlisted/farmai/terravibes/$service
export DEV_TAG=$SERVICE_TAG:dev
export MAIN_TAG=$SERVICE_TAG:${{ github.run_id }}
# az acr import --name ${{ secrets.ACR_NAME }} --source $DEV_TAG --image $MAIN_TAG --force || exit 1
echo Retagging from $DEV_TAG to $MAIN_TAG
done
- name: Adjust default tag
run: |
ROOT=$(git rev-parse --show-toplevel)
CONSTANTS_MODULE="$ROOT"/src/vibe_core/vibe_core/cli/constants.py
sed -i "s|DEFAULT_IMAGE_TAG.*|DEFAULT_IMAGE_TAG = ${{ github.run_id }}|g" "$CONSTANTS_MODULE"
- name: Check modified file
run: cat src/vibe_core/vibe_core/cli/constants.py
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "FarmVibes.AI Release Pipeline"
ROOT=$(git rev-parse --show-toplevel)
CONSTANTS_MODULE="$ROOT"/src/vibe_core/vibe_core/cli/constants.py
RELEASE_BRANCH=release-main-${{ github.run_id }}
git checkout -b $RELEASE_BRANCH
git add $CONSTANTS_MODULE
git commit -m "Update default tag to latest image"
git push --set-upstream origin $RELEASE_BRANCH