-
Notifications
You must be signed in to change notification settings - Fork 8
57 lines (51 loc) · 1.88 KB
/
after-merge-dependabot.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
name: after-merge-dependabot
on:
pull_request_target:
types: [closed]
jobs:
check:
if: github.event.pull_request.merged && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
concurrency:
group: dependabot-after-merge
cancel-in-progress: true
steps:
- name: Fetch dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2.2.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: oprypin/find-latest-tag@v1
id: octokit
with:
repository: ${{ github.repository }}
prefix: v
- name: Parse last release
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: '${{ steps.octokit.outputs.tag }}'
version_extractor_regex: 'v(.*)$'
- name: Compute tag
id: compte_tag
run: |
major=${{ steps.semver_parser.outputs.major }}
minor=${{ steps.semver_parser.outputs.minor }}
patch=${{ steps.semver_parser.outputs.patch }}
if [ "${{ steps.dependabot-metadata.outputs.update-type }}" == "version-update:semver-minor" ]; then
minor=$((minor+1))
patch=0
echo "::warning::bumping minor version"
elif [ "${{ steps.dependabot-metadata.outputs.update-type }}" == "version-update:semver-patch" ]; then
patch=$((patch+1))
echo "::warning::bumping patch version"
fi
tag="v${major}.${minor}.${patch}"
echo "::set-output name=tag::${tag}"
echo "::warning::tag == ${tag}"
- name: Create tag
uses: tvdias/github-tagger@v0.0.2
if: steps.compte_tag.outputs.tag != steps.semver_parser.outputs.fullversion
with:
repo-token: "${{ secrets.AUTO_MERGE_TOKEN }}"
tag: "${{ steps.compte_tag.outputs.tag }}"