Skip to content

Commit

Permalink
auto create release tag
Browse files Browse the repository at this point in the history
  • Loading branch information
lfkdev committed Jun 29, 2024
1 parent e75fae2 commit b0b3cd9
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@ jobs:
run: |
python -m unittest discover src
create-tag:
needs: ansible-link-ci
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Get version
working-directory: ${{ github.workspace }}/src
id: get_version
run: |
echo "VERSION=$(python -c "from src.version import VERSION; print(VERSION)")" >> $GITHUB_OUTPUT
- name: Create and push tag
run: |
git config user.name github-actions
git config user.email [email protected]
git tag -a v${{ steps.get_version.outputs.VERSION }} -m "Release version ${{ steps.get_version.outputs.VERSION }}"
git push origin v${{ steps.get_version.outputs.VERSION }}
build-and-release:
needs: ansible-link-ci
runs-on: ubuntu-latest
Expand All @@ -87,6 +111,7 @@ jobs:
sha256sum ansible-link-${{ steps.get_version.outputs.VERSION }}.zip > ansible-link-${{ steps.get_version.outputs.VERSION }}.sha256
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
ansible-link-${{ steps.get_version.outputs.VERSION }}.zip
Expand All @@ -96,4 +121,4 @@ jobs:
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit b0b3cd9

Please sign in to comment.