Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: sign commit when updating stable json file [skip ci] #19401

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions jenkinsfiles/stable
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,29 @@ pipeline {
--json-file ./downloads/v1/versions/stable.json
"""

sh 'git config user.email "$GITHUB_EMAIL"'
sh 'git config user.name "$GITHUB_USER"'

releasesBranch = "add-release-${imageTag}"

sh "git checkout -b $releasesBranch"
sh 'git add ./downloads/v1/versions/stable.json'
sh "git diff-index --quiet HEAD || git commit -m \"chore: add version $imageTag to stable.json\""
sh "git push https://${GITHUB_TOKEN}@github.com/$DHIS2_RELEASES_REPO"

sh "gh pr create --head $releasesBranch --fill-first --reviewer Philip-Larsen-Donnelly,dhis2/devops"
withCredentials([
file(credentialsId: 'github-private-signing-key', variable: 'SIGNING_PRIVATE_KEY_PATH'),
file(credentialsId: 'github-public-signing-key', variable: 'SIGNING_PUBLIC_KEY_PATH')
]) {
sh 'cp $SIGNING_PRIVATE_KEY_PATH ~/.ssh/signing_key'
sh 'cp $SIGNING_PUBLIC_KEY_PATH ~/.ssh/signing_key.pub'
sh 'chmod --changes 600 ~/.ssh/signing_key ~/.ssh/signing_key.pub'

sh 'git config user.email "$GITHUB_EMAIL"'
sh 'git config user.name "$GITHUB_USER"'
sh 'git config user.signingkey ~/.ssh/signing_key.pub'
sh 'git config commit.gpgSign true'
sh 'git config gpg.format ssh'

releasesBranch = "add-release-${imageTag}"

sh "git checkout -b $releasesBranch"
sh 'git add ./downloads/v1/versions/stable.json'
sh "git diff-index --quiet HEAD || git commit -S -m \"chore: add version $imageTag to stable.json\""
sh 'git push https://[email protected]/$DHIS2_RELEASES_REPO'

sh "gh pr create --head $releasesBranch --fill-first --reviewer Philip-Larsen-Donnelly,dhis2/devops"
}
}
}
}
Expand Down