Skip to content

Commit

Permalink
Bring back autoupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatXliner authored Jan 1, 2025
1 parent 42dbc15 commit 5e9799c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 }}"

0 comments on commit 5e9799c

Please sign in to comment.