-
Notifications
You must be signed in to change notification settings - Fork 113
86 lines (76 loc) · 3.29 KB
/
build-pr-artifacts.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Build Artifacts for PRs
on:
pull_request:
types:
- opened
- reopened
- synchronize
env:
type: ut
jobs:
generate-tag-names:
runs-on: ubuntu-latest
name: Generate Tag Names
# Skip for the release pull requests as staging artifacts will be generated
if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main'
outputs:
tag_name: ${{ steps.gen_tag_names.outputs.tag_name }}
tag_name_ut: ${{ steps.gen_tag_names.outputs.tag_name_ut }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
# Replace problematic characters in branch name (like '/') with safe characters (like '.')
- name: Generate Tag Names
id: gen_tag_names
run: |
tag_name=$(echo ${{ github.head_ref }} | tr "/" .)
echo "Tag Name: $tag_name"
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
tag_name_ut="ut-$tag_name"
echo "UT Tag Name: $tag_name_ut"
echo "tag_name_ut=$tag_name_ut" >> $GITHUB_OUTPUT
build-transformer-image:
name: Build Transformer Docker Image - PR
# Skip for the release pull requests as staging artifacts will be generated
# Skip main to develop sync pull requests
if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main'
needs: [generate-tag-names]
uses: ./.github/workflows/build-push-docker-image.yml
with:
build_tag: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }}
push_tags: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }}
img_tag: ${{ needs.generate-tag-names.outputs.tag_name }}
dockerfile: Dockerfile
load_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
build-user-transformer-image:
name: Build User Transformer Docker Image - PR
# Skip for the release pull requests as staging artifacts will be generated
if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main'
needs: [generate-tag-names]
uses: ./.github/workflows/build-push-docker-image.yml
with:
build_tag: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }}
push_tags: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }}
img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }}
dockerfile: Dockerfile-ut-func
load_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
test-step:
name: test job
runs-on: ubuntu-latest
steps:
- name: test step one
if: ${{ env.type == 'dt' }}
run: |
echo "test echo one"
- name: test step two
if: ${{ env.type }} == 'dt'
run: |
echo "test echo two"