Skip to content

Commit

Permalink
feat: Create version-update.yml
Browse files Browse the repository at this point in the history
Create version-update.yml github action for automatic update of ai4-template version from the VERSION file
  • Loading branch information
vykozlov authored and valentin.kozlov committed Jul 9, 2024
1 parent ad1cfc6 commit fd94125
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/version-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: version-update
on:
push:
branches:
- 'main'
paths:
- 'VERSION'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Commit files
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
export VERSION=$(cat VERSION |tr -d "\n\r")
echo "Found ${VERSION} version"
sed -i "s/\"__ai4_template\":.*/\"__ai4_template\": \"ai4-template\/${VERSION}\",/I" cookiecutter.json
git commit -a -m "Update ai4-template version in the cookiecutter.json for ${VERSION}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
branch: ${{ github.head_ref }}
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

"__repo_name": "{{ ' '.join(cookiecutter.project_name.split()).lower().replace(' ', '-') }}",
"__app_name": "{{ cookiecutter.__repo_name.replace('-','_') }}",
"__ai4_template": "ai4-template/2.1.0",
"__ai4_template": "ai4-template/2.1.1",

"__prompts__": {
"git_base_url": "git_base_url - Remote URL to host your new repositories (git), e.g.\n https://github.com/ai4os-hub (i.e. at github)",
Expand Down

0 comments on commit fd94125

Please sign in to comment.