-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (48 loc) · 1.72 KB
/
autoupdate.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
name: Autoupdate
on:
push:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *" # Run every month
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: python3 -m pip install --upgrade pip copier poetry poetry-plugin-up
- name: Update template
run: make all
- name: Check if we should commit
id: commit_check
run: |
if git diff --quiet
then
echo "should_commit==false" >> $GITHUB_OUTPUT
else
echo "should_commit==true" >> $GITHUB_OUTPUT
fi
- name: Commit updated lockfiles
uses: EndBug/add-and-commit@v9
id: make_commit
if: ${{ contains(steps.commit_check.outputs.should_commit, 'true') }}
with:
default_author: github_actions
message: ":robot: :arrow_up: Updated deps and lockfile\n\nThis is an automated action"
- name: Generate tag
id: gen_tag_name
if: ${{ contains(steps.commit_check.outputs.should_commit, 'true') }}
run: |
git fetch --tags
NEW_TAG=$(git tag -l | sort -V | tail -n 1 | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')
echo "NEW_TAG=$NEW_TAG" >> "$GITHUB_OUTPUT"
- uses: rickstaa/action-create-tag@v1
if: ${{ contains(steps.commit_check.outputs.should_commit, 'true') }}
with:
tag: "${{ steps.gen_tag_name.outputs.NEW_TAG }}"
commit_sha: "${{ steps.make_commit.outputs.commit_long_sha }}"