-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (56 loc) · 1.83 KB
/
build-update-gitops.yaml
File metadata and controls
66 lines (56 loc) · 1.83 KB
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
57
58
59
60
61
62
63
64
65
66
name: Build and update gitops repo
permissions: {}
env:
TARGET_FILE: 'values.dev.yaml'
WORKING_DIR: 'developer-portal'
YAML_PROPERTY_PATH: '.upstream.backstage.image.tag'
HUSKY: 0
on:
push:
paths-ignore:
- '.github/**'
- 'README.md'
- '.husky/**'
- 'catalog-info.yaml'
- '**/*.md'
- 'examples/**'
branches: ['main']
# save resources. Don't take up a queue space doing a duplicate build
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
call-build-workflow:
permissions:
contents: read
packages: write
uses: ./.github/workflows/build.yaml
get-short-sha:
uses: ./.github/workflows/get-short-sha.yaml
update-gitops-file:
runs-on: ubuntu-latest
needs: [call-build-workflow, get-short-sha]
steps:
- name: Setup gitops repo access
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}
- name: Checkout CD repo
uses: actions/checkout@v6
with:
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}
repository: ${{ secrets.MANIFEST_REPO }}
- name: 'Configure git'
# From https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Update image tag
run: |
cd ${{ env.WORKING_DIR }}
yq -i '${{ env.YAML_PROPERTY_PATH }} = "${{ needs.get-short-sha.outputs.SHORT_SHA }}"' ${{ env.TARGET_FILE }}
- name: Commit and push update
run: |
git commit -am "Update image tag for dev"
git push origin