This repository has been archived by the owner on May 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (79 loc) · 3.02 KB
/
update-depending-project.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
73
74
75
76
77
78
79
80
81
name: update-depending-project
on:
workflow_call:
inputs:
APP_VERSION:
type: string
required: true
REPO_OWNER:
type: string
required: true
REPO_NAME:
type: string
required: true
LABEL_NAME:
type: string
required: true
TARGET_BRANCH:
type: string
required: true
secrets:
GH_ADMIN_TOKEN:
required: true
jobs:
update-depending-project:
runs-on: ubuntu-latest
env:
APP_VERSION: ${{ inputs.APP_VERSION }}
REPO_OWNER: ${{ inputs.REPO_OWNER }}
REPO_NAME: ${{ inputs.REPO_NAME }}
LABEL_NAME: ${{ inputs.LABEL_NAME }}
TARGET_BRANCH: ${{ inputs.TARGET_BRANCH }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
repository: ${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}
ref: ${{ env.TARGET_BRANCH }}
token: ${{ secrets.GH_ADMIN_TOKEN }}
- name: Create and Checkout new Branch
run: git checkout -b chore/update-cwa-parent-${{ env.APP_VERSION }}
- name: Set new Parent Version
run: |
sudo apt-get update
sudo apt-get install xmlstarlet -y
xmlstarlet edit -P -L --update _:project/_:parent/_:version --value ${{ env.APP_VERSION }} pom.xml
- name: Commit and Push changes
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git commit -a --allow-empty -m "Update CWA-Parent to ${{ env.APP_VERSION }}"
git push --set-upstream origin chore/update-cwa-parent-${{ env.APP_VERSION}}
- name: Create Pull Request
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_ADMIN_TOKEN }}
script: |
const pr = github.rest.pulls.create({
owner: process.env.REPO_OWNER,
repo: process.env.REPO_NAME,
title: 'Chore: Update CWA-Parent to ' + process.env.APP_VERSION,
head: 'chore/update-cwa-parent-' + process.env.APP_VERSION,
base: process.env.TARGET_BRANCH,
body: `### Update the parent pom (cwa-parent) to the last released version.
This PR will update several dependencies within this project.
Please do a full integration test before merging this PR.
Also please have a look on the [Release Notes](https://github.com/corona-warn-app/cwa-parent/releases/tag/${process.env.APP_VERSION}) of this new CWA-Parent version.`,
maintainer_can_modify: true,
draft: false,
});
pr.then(response => {
if (response.status === 201) {
github.rest.issues.addLabels({
owner: process.env.REPO_OWNER,
repo: process.env.REPO_NAME,
issue_number: response.data.number,
labels: [ process.env.LABEL_NAME ]
});
}
});