|
1 | 1 | name: APPCD Diff check
|
2 | 2 | on:
|
| 3 | + push: |
| 4 | + branches: |
| 5 | + - feature/updated_gh_action |
3 | 6 | pull_request:
|
4 | 7 | branches:
|
5 | 8 | - main
|
|
8 | 11 | runs-on: ubuntu-latest
|
9 | 12 | steps:
|
10 | 13 | - name: Checkout Main Branch
|
11 |
| - uses: actions/checkout@v2 |
| 14 | + uses: actions/checkout@v4 |
12 | 15 | with:
|
13 | 16 | ref: main
|
14 | 17 | path: main_branch
|
| 18 | + fetch-depth: 1 |
15 | 19 | - name: Login to docker
|
16 | 20 | run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
|
17 |
| - |
18 | 21 | - name: Generate IaC from Main Branch
|
19 | 22 | run: |
|
20 | 23 | mkdir -p artifact/main/
|
21 | 24 | docker run --rm \
|
22 |
| - --workdir=/code \ |
23 |
| - -v ./main_branch:/code -v ./artifact/main:/artifact/main ghcr.io/appcd-dev/appcd-dist/appcd@sha256:a38ade31e60f3f7f76b1135a388db158eed3c90816d5b5c09e33dd806efb67d5 \ |
24 |
| - generate --mode ci --output=/artifact/main/.appcd/charts |
| 25 | + --workdir=/code \ |
| 26 | + -v ./main_branch:/code \ |
| 27 | + -v ./artifact/main:/artifact/main \ |
| 28 | + ghcr.io/appcd-dev/appcd-dist/appcd@v0.9.0 \ |
| 29 | + generate --lang Python --output=artifact/main/.appcd/charts --iac-type Helm |
| 30 | + cd artifact/main/.appcd/charts |
| 31 | + unzip DogeAPI.zip && rm DogeAPI.zip |
25 | 32 | - name: Checkout PR Branch
|
26 |
| - uses: actions/checkout@v2 |
| 33 | + uses: actions/checkout@v4 |
27 | 34 | with:
|
28 | 35 | ref: ${{ github.head_ref }}
|
29 | 36 | path: pr_branch
|
| 37 | + fetch-depth: 1 |
30 | 38 | - name: Extract branch name
|
31 | 39 | id: extract_branch
|
32 | 40 | run: echo "branch=$(basename ${{ github.head_ref}})" >> $GITHUB_OUTPUT
|
|
37 | 45 | mkdir -p artifact/${{ steps.extract_branch.outputs.branch }}/
|
38 | 46 | docker run --rm \
|
39 | 47 | --workdir=/code \
|
40 |
| - -v ./pr_branch/:/code -v ./artifact/${{ steps.extract_branch.outputs.branch }}:/artifact/${{ steps.extract_branch.outputs.branch }} ghcr.io/appcd-dev/appcd-dist/appcd@sha256:a38ade31e60f3f7f76b1135a388db158eed3c90816d5b5c09e33dd806efb67d5 \ |
41 |
| - generate --mode ci --output=/artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts |
| 48 | + -v ./pr_branch/:/code \ |
| 49 | + -v ./artifact/${{ steps.extract_branch.outputs.branch }}:/artifact/${{ steps.extract_branch.outputs.branch }} \ |
| 50 | + ghcr.io/appcd-dev/appcd-dist/appcd@v0.9.0 \ |
| 51 | + generate --lang Python --iac-type Helm --output=artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts |
| 52 | + cd artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts |
| 53 | + unzip DogeAPI.zip && rm DogeAPI.zip |
42 | 54 | - name: Copy infrastructure files if empty
|
43 | 55 | run: |
|
44 | 56 | cd pr_branch
|
|
51 | 63 | git commit -m "Adds IaC dependency files"
|
52 | 64 | git push
|
53 | 65 | fi
|
54 |
| - cd ../ |
55 | 66 | - name: Generate diff between Main and PR branch
|
56 | 67 | run: |
|
57 | 68 | mkdir -p pr_branch/deployment_files
|
|
0 commit comments