1111 type : boolean
1212 default : false
1313 createPullRequest :
14- description : ' Create pull request back into main '
14+ description : ' Create pull request back into dev-v2 '
1515 required : true
1616 type : boolean
17- default : false
18- uploadJWT :
19- description : ' Temporary JWT to publish packages to up-ap.nginx.com'
20- required : true
21- type : string
22- default : ' '
17+ default : false
2318 workflow_call :
2419
2520permissions :
@@ -30,17 +25,22 @@ jobs:
3025 permissions :
3126 contents : write
3227 pull-requests : write
28+
3329 name : Update Release
34- runs-on : ubuntu-22.04
30+ runs-on : ubuntu-22.04-amd64
3531 steps :
3632 - uses : actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
3733 with :
3834 fetch-depth : 0
35+
3936 - uses : actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
4037 with :
4138 go-version-file : ' go.mod'
39+
4240 - uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
41+
4342 -
run :
npm install [email protected] 43+
4444 - name : Create Draft Release
4545 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
4646 id : release
@@ -115,30 +115,36 @@ jobs:
115115 release_upload_url: release.data.upload_url,
116116 }
117117 }
118+
118119 - name : Set Environment Variables
119120 run : |
120121 echo "${{steps.release.outputs.result}}"
121122 echo "VERSION=$(echo '${{steps.release.outputs.result}}' | jq -r '.version')" >> $GITHUB_ENV
122123 echo "RELEASE_ID=$(echo '${{steps.release.outputs.result}}' | jq -r '.release_id')" >> $GITHUB_ENV
123124 echo "RELEASE_UPLOAD_URL=$(echo '${{steps.release.outputs.result}}' | jq -r '.release_upload_url')" >> $GITHUB_ENV
125+
124126 - name : Setup build environment
125127 run : |
126128 sudo apt-get update
127129 sudo apt-get install -y gpgv1 monkeysphere
128130 go install github.com/goreleaser/nfpm/v2/cmd/[email protected] 131+
129132 - name : Tag release
130133 run : |
131134 git config --global user.name 'github-actions'
132135 git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
133136 git tag -a "v${{env.VERSION}}" -m "CI Autogenerated"
134137 git tag -a "sdk/v${{env.VERSION}}" -m "CI Autogenerated"
138+
135139 - name : Push Tags
136140 if : ${{ inputs.publishPackages == true }}
137141 run : |
138142 git push origin "v${{env.VERSION}}"
139143 git push origin "sdk/v${{env.VERSION}}"
144+
140145 - name : Set up Docker Buildx
141146 uses : docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
147+
142148 - name : Build Docker Image
143149 uses : docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
144150 with :
@@ -150,68 +156,44 @@ jobs:
150156 no-cache : true
151157 build-args : |
152158 package_type=signed-package
159+
153160 - name : Build Packages
154161 env :
155162 INDIGO_GPG_AGENT : ${{ secrets.INDIGO_GPG_AGENT }}
156163 NFPM_SIGNING_KEY_FILE : .key.asc
157164 run : |
158165 echo "$INDIGO_GPG_AGENT" | base64 --decode > .key.asc
159166 make clean package
160- - name : Azure Login
161- uses : azure/login@6b2456866fc08b011acb422a92a4aa20e2c4de32 # v2.1.0
162- with :
163- creds : ${{ secrets.AZURE_CREDENTIALS }}
164- - name : Azure Upload Release Packages
165- uses : azure/CLI@965c8d7571d2231a54e321ddd07f7b10317f34d9 # v2.0.0
167+
168+ - name : Get Id Token
169+ if : ${{ inputs.publishPackages == true }}
170+ uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
171+ id : idtoken
166172 with :
167- inlineScript : |
168- for i in ./build/azure/packages/nginx-agent*; do
169- az storage blob upload --auth-mode=login -f "$i" -c ${{ secrets.AZURE_CONTAINER_NAME }} \
170- --account-name ${{ secrets.AZURE_ACCOUNT_NAME }} --overwrite -n nginx-agent/${GITHUB_REF##*/}/${i##*/}
171- done
172- - name : Azure Logout
173- run : |
174- az logout
175- if : always()
176- - name : Upload Release Assets
177- env :
178- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
179- # clobber overwrites existing assets of the same name
180- run : |
181- gh release upload --clobber v${{env.VERSION}} \
182- $(find ./build/github/packages -type f \( -name "*.deb" -o -name "*.rpm" -o -name "*.pkg" -o -name "*.apk" \))
173+ script : |
174+ let id_token = await core.getIDToken()
175+ core.setOutput('id_token', id_token)
176+
183177 - name : Publish Release Packages
184178 if : ${{ inputs.publishPackages == true }}
185179 env :
186- TOKEN : ${{ inputs.uploadJWT }}
187- UPLOAD_URL : " https://up-ap-tmp .nginx.com"
180+ TOKEN : ${{ steps.idtoken.outputs.id_token }}
181+ UPLOAD_URL : " https://up-ap.nginx.com"
188182 run : |
189183 make release
190- - name : Publish Github Release
191- if : ${{ inputs.publishPackages == true }}
192- uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
193- with :
194- script : |
195- const {RELEASE_ID} = process.env
196- const release = (await github.rest.repos.updateRelease({
197- owner: context.payload.repository.owner.login,
198- repo: context.payload.repository.name,
199- release_id: `${RELEASE_ID}`,
200- draft: false,
201- }))
202- console.log(`Release published: ${release.data.html_url}`)
184+
203185 - name : Create Pull Request
204186 if : ${{ inputs.publishPackages == true && inputs.createPullRequest == true}}
205187 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
206188 with :
207189 script : |
208190 const { repo, owner } = context.repo;
209191 const result = await github.rest.pulls.create({
210- title: 'Merge ${{ github.ref_name }} back into main ',
192+ title: 'Merge ${{ github.ref_name }} back into dev-v2 ',
211193 owner,
212194 repo,
213195 head: '${{ github.ref_name }}',
214- base: 'main ',
196+ base: 'dev-v2 ',
215197 body: [
216198 'This PR is auto-generated by the release branch workflow.'
217199 ].join('\n')
0 commit comments