Skip to content

Commit

Permalink
add update auto-tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetrucciani committed Feb 1, 2023
1 parent 5ae97cc commit f7a3118
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: tag

on:
push: {branches: [master]}

jobs:
tag:
name: tag
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- id: var
run: |
version="$(sed -E 's#mypy==(.*)#\1#g' ./requirements.txt)"
create_tag="$(git ls-remote --exit-code origin "refs/tags/$version" >/dev/null && echo false || echo true)"
echo "version=$version" >>$GITHUB_OUTPUT
echo "create_tag=$create_tag" >>$GITHUB_OUTPUT
- name: tag
if: steps.var.outputs.create_tag == 'true'
env:
VERSION: ${{ steps.var.outputs.version }}
run: |
git config --global user.name 'jacobi petrucciani'
git config --global user.email '[email protected]'
git tag -a "$VERSION" -m "$VERSION"
git push --tags
12 changes: 8 additions & 4 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.10'
architecture: x64
- name: check version
- id: version
name: check version
run: |
pip install -U mypy
pip freeze | grep 'mypy==' >requirements.txt
version="$(sed -E 's#mypy==(.*)#\1#g' ./requirements.txt)"
echo "version=$version" >>$GITHUB_OUTPUT
echo "message=automatic mypy update [$version]" >>$GITHUB_OUTPUT
- uses: peter-evans/[email protected]
id: new_pull_request
with:
delete-branch: true
title: automatic mypy update
commit-message: automatic mypy update
title: ${{ steps.version.outputs.message }}
commit-message: ${{ steps.version.outputs.message }}
branch: automatic-mypy-update
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- if: steps.new_pull_request.outputs.pull-request-url != ''
Expand Down

0 comments on commit f7a3118

Please sign in to comment.