-
Notifications
You must be signed in to change notification settings - Fork 6
84 lines (72 loc) · 2.54 KB
/
Copy pathversion_bumper.yml
File metadata and controls
84 lines (72 loc) · 2.54 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Check for new upstream releases
on:
schedule:
- cron: "5 4 * * 1"
workflow_dispatch: {}
permissions:
contents: write
pull-requests: write
jobs:
discover:
name: Discover available updates
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.discover.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Discover role updates
id: discover
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python .github/scripts/discover_versions.py
bump:
name: Bump ${{ matrix.role }} to ${{ matrix.new_version }}
needs: discover
if: needs.discover.outputs.matrix != '[]'
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{ fromJson(needs.discover.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Apply version update
env:
ROLE_NAME: ${{ matrix.role }}
NEW_VERSION: ${{ matrix.new_version }}
REPO: https://${{ matrix.host }}/${{ matrix.repo }}
run: python .github/scripts/version_bump.py --role "${ROLE_NAME}" --new-version "${NEW_VERSION}" --repo "${REPO}"
- name: Check git status
id: git_state
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- name: Create pull request
if: steps.git_state.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: autoupdate/${{ matrix.role }}/${{ matrix.new_version }}
delete-branch: true
commit-message: "chore(${{ matrix.role }}): bump to ${{ matrix.new_version }}"
title: "patch(${{ matrix.role }}): bump to ${{ matrix.new_version }}"
body-path: /tmp/version-bump-report-${{ matrix.role }}-${{ matrix.new_version }}.md
- name: No changes
if: steps.git_state.outputs.changed != 'true'
run: echo "No updates were required for ${{ matrix.role }}."