@@ -29,9 +29,6 @@ defaults:
2929 run :
3030 shell : bash
3131
32- env :
33- GOPROXY : ${{ github.repository_owner != 'nginx' && 'direct' || (inputs.is_production_release || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && format('https://{0}:{1}@{2}', secrets.ARTIFACTORY_USER, secrets.ARTIFACTORY_TOKEN, secrets.ARTIFACTORY_ENDPOINT) || format('https://{0}:{1}@{2}', secrets.ARTIFACTORY_USER, secrets.ARTIFACTORY_TOKEN, secrets.ARTIFACTORY_DEV_ENDPOINT) }}
34-
3532concurrency :
3633 group : ${{ github.ref_name }}-ci
3734 cancel-in-progress : true
5350 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5451 with :
5552 fetch-depth : 0
53+ - name : Configure GOPROXY
54+ id : goproxy
55+ run : |
56+ if [[ "${{ secrets.ARTIFACTORY_USER }}" == "" ]]; then
57+ echo "No Artifactory secrets available - using direct GOPROXY"
58+ GOPROXY_VALUE="direct"
59+ elif [[ "${{ inputs.is_production_release }}" == "true" ]] || [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
60+ echo "Production mode - using production Artifactory"
61+ GOPROXY_VALUE="https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@${{ secrets.ARTIFACTORY_ENDPOINT }}"
62+ else
63+ echo "Development mode - using dev Artifactory"
64+ GOPROXY_VALUE="https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@${{ secrets.ARTIFACTORY_DEV_ENDPOINT }}"
65+ fi
66+ echo "goproxy=${GOPROXY_VALUE}" >> $GITHUB_OUTPUT
67+ echo "GOPROXY=${GOPROXY_VALUE}" >> $GITHUB_ENV
5668
5769 - name : Setup Golang Environment
5870 uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
92104 name : Unit Tests
93105 runs-on : ubuntu-24.04
94106 needs : vars
107+ env :
108+ GOPROXY : ${{ needs.vars.outputs.goproxy }}
95109 steps :
96110 - name : Checkout Repository
97111 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -144,6 +158,8 @@ jobs:
144158 name : Build Binary
145159 runs-on : ${{ github.repository_owner == 'nginx' && (inputs.is_production_release || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'ubuntu-24.04-amd64' || 'ubuntu-24.04' }}
146160 needs : [vars, unit-tests, njs-unit-tests]
161+ env :
162+ GOPROXY : ${{ needs.vars.outputs.goproxy }}
147163 permissions :
148164 contents : write # for goreleaser/goreleaser-action and lucacome/draft-release to create/update releases
149165 id-token : write # for goreleaser/goreleaser-action to sign artifacts
@@ -345,6 +361,8 @@ jobs:
345361 name : CEL Tests
346362 runs-on : ubuntu-24.04
347363 needs : vars
364+ env :
365+ GOPROXY : ${{ needs.vars.outputs.goproxy }}
348366 steps :
349367 - name : Checkout Repository
350368 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
0 commit comments