forked from broadinstitute/cromwell
-
Notifications
You must be signed in to change notification settings - Fork 6
72 lines (70 loc) · 3.19 KB
/
make_publish_prs.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
name: Make publish PRs
on:
workflow_dispatch:
inputs:
old_cromwell_version:
description: 'What version of Cromwell to update from'
required: true
new_cromwell_version:
description: 'What version of Cromwell to update to'
required: true
jira_ticket:
description: 'The JIRA ticket to link the update PR to'
required: true
jobs:
make-firecloud-develop-pr:
name: Create firecloud-develop PR
runs-on: ubuntu-latest
steps:
- name: Clone firecloud-develop
uses: actions/checkout@v2
with:
repository: broadinstitute/firecloud-develop
token: ${{ secrets.BROADBOT_GITHUB_TOKEN }} # Has to be set at checkout AND later when pushing to work
path: firecloud-develop
- name: Update & push to firecloud-develop
id: update-and-push
env:
BROADBOT_GITHUB_TOKEN: ${{ secrets.BROADBOT_GITHUB_TOKEN }}
run: |
cd firecloud-develop
JIRA_TICKET=${{ github.event.inputs.jira_ticket }}
OLD_CROMWELL_V=${{ github.event.inputs.old_cromwell_version }}
NEW_CROMWELL_V=${{ github.event.inputs.new_cromwell_version }}
NEW_BRANCH_NAME="${JIRA_TICKET}_cromwell_${NEW_CROMWELL_V}"
TEMP=$(mktemp)
git checkout -b "${NEW_BRANCH_NAME}"
SED_STRING="s/${OLD_CROMWELL_V}/${NEW_CROMWELL_V}/g"
FILES=( "base-configs/cromwell/cromwell.conf.ctmpl" "run-context/fiab/scripts/FiaB_images.env" )
for i in "${FILES[@]}"
do
echo "Updating ${i}"
sed "${SED_STRING}" ${i} > ${TEMP}
mv ${TEMP} ${i}
git add ${i}
done
echo "Pushing to firecloud-develop branch ${NEW_BRANCH_NAME}"
git config --global user.name "broadbot"
git config --global user.email "[email protected]"
git commit -m "Updating Cromwell version to ${NEW_CROMWELL_V}"
git push https://broadbot:[email protected]/broadinstitute/firecloud-develop.git ${NEW_BRANCH_NAME}
echo "NEW_BRANCH_NAME=${NEW_BRANCH_NAME}" >> $GITHUB_OUTPUT
- name: Create firecloud-develop PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.BROADBOT_GITHUB_TOKEN }}
script: |
const result = await github.rest.pulls.create({
title: '${{ github.event.inputs.jira_ticket }}: Update Cromwell version to ${{ github.event.inputs.new_cromwell_version }}',
owner: 'broadinstitute',
repo: 'firecloud-develop',
head: '${{ steps.update-and-push.outputs.NEW_BRANCH_NAME }}',
base: 'dev',
body: [
'This PR is auto-generated by',
'[Cromwell actions/make_publish_prs](https://github.com/broadinstitute/cromwell/blob/develop/.github/workflows/make_publish_prs.yml), using',
'[github actions/github-script](https://github.com/actions/github-script).',
'',
'It updates cromwell from version ${{ github.event.inputs.old_cromwell_version }} to ${{ github.event.inputs.new_cromwell_version }}.'
].join('\n')
});