This repository was archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
61 lines (52 loc) · 1.76 KB
/
auto-version-bump.yml
File metadata and controls
61 lines (52 loc) · 1.76 KB
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
name: Auto-bump Version
on:
issue_comment:
types: ["created"]
jobs:
bump-version:
if: (
(github.event.issue.pull_request != null) &&
contains(github.event.comment.body, '/bump-version')
)
runs-on: ubuntu-latest
steps:
- name: Get branch name
uses: actions/github-script@v3.1.0
id: branch-name
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const { data: pullRequest } = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.issue.number,
});
return pullRequest.head.ref
- name: Pull version from comment body
run: |
NEW_VERSION=$(echo ${{ github.event.comment.body }} | grep '/bump-version' | cut -d" " -f2)
[[ "${NEW_VERSION}" =~ ^v[0-9].[0-9].[0-9]$ ]]
echo "new_version=${NEW_VERSION}" >> $GITHUB_ENV
- name: Checkout repo
uses: actions/checkout@v2.3.4
with:
ref: ${{ steps.branch-name.outputs.result }}
- name: Setup Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Update Azure ARM template
working-directory: scripts
run: |
python auto-version-bump.py $new_version
- name: Add and commit updated file
uses: EndBug/add-and-commit@v5
with:
add: 'azure.deploy.json'
author_name: CI User
author_email: ci-user@github.local
branch: ${{ steps.branch-name.outputs.result }}
message: "Update versions in Azure ARM template"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}