-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Create Ops PR | ||
on: | ||
workflow_run: | ||
workflows: | ||
- Build | ||
branches-ignore: | ||
- main | ||
types: | ||
- completed | ||
|
||
jobs: | ||
download_build_data_artifact: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifact | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id, | ||
}); | ||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "build_data.json" | ||
})[0]; | ||
let download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
let fs = require('fs'); | ||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/build_data.zip`, Buffer.from(download.data)); | ||
- name: Unzip artifact | ||
run: unzip context.zip | ||
- name: Return Parsed JSON | ||
uses: actions/github-script@v6 | ||
id: return-parsed-json | ||
with: | ||
script: | | ||
let fs = require('fs'); | ||
let data = fs.readFileSync('./build_data.json'); | ||
return JSON.parse(data); | ||
outputs: | ||
image_version: ${{ fromJSON(steps.return-parsed-json.outputs.result).image_version }} | ||
|
||
create_ops_pr: | ||
name: Create Ops PR | ||
runs-on: ubuntu-20.04 | ||
needs: download_build_data_artifact | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout Ops repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: SystemCraftsman/homebrew-strimzi-kafka-cli | ||
ref: main | ||
|
||
- name: Apply changes | ||
run: | | ||
echo "${{ needs.download_build_data_artifact.outputs.image_version }}" > test.txt | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: Update image tag and revision for prod upgrade | ||
committer: GitHub <noreply@github.com> | ||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||
branch: prod-upgrade-${{ needs.download_build_data_artifact.outputs.image_version }} | ||
assignees: mabulgu | ||
reviewers: mabulgu | ||
title: '[Automated PR] Update image tag and revision for prod upgrade' |