-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create automatic version tagging action
Erase invalid import
- Loading branch information
Showing
4 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Tag new version | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
VERSION_PATH: arabot/__init__.py | ||
VERSION_REGEX: '^\+__version__ = "(.+)"$' | ||
|
||
jobs: | ||
tag: | ||
name: Autotag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout commit | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: ${{ env.VERSION_PATH }} | ||
sparse-checkout-cone-mode: false | ||
fetch-depth: 0 | ||
|
||
- name: Set credentials | ||
run: | | ||
git config user.name github-actions | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
- name: Tag commit | ||
id: tag | ||
run: | | ||
LAST_TAG=$(git describe --abbrev=0) | ||
VERSION=$(git diff "$LAST_TAG" HEAD "$VERSION_PATH" | sed -nr "s/$VERSION_REGEX/\1/p") | ||
[ "$VERSION" ] && git tag -m "v$VERSION" "$VERSION" | ||
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
- name: Push tag | ||
if: steps.tag.outputs.version | ||
run: git push --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters