-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (50 loc) · 1.82 KB
/
release-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Auto Tag New Releases
on:
push:
branches:
- main
jobs:
version-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ssh-key: "${{ secrets.COMMIT_KEY }}"
fetch-depth: 0
- name: Get Latest Tag
id: get-latest-tag
uses: actions-ecosystem/[email protected]
with:
semver_only: true
with_initial_version: false
- name: Code vs Releases Version Check
id: release-info
run: |
RELEASE_VERSION=$(echo $LATEST_RELEASE | tr -d "v ")
VERSION=$(cat diplomat/__init__.py | grep "__version__" | cut -d "=" -f 2 | tr -d '" ')
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
then
echo "$VERSION is not a valid version!"
exit 1
fi
PROPOSED_TAG="v$VERSION"
echo "Python package version: $VERSION"
echo "Github release version: $RELEASE_VERSION"
echo "Next proposed tag: $PROPOSED_TAG"
echo "PYTHON_VERSION=$VERSION" >> "$GITHUB_OUTPUT"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> "$GITHUB_OUTPUT"
echo "NEXT_TAG=$PROPOSED_TAG" >> "$GITHUB_OUTPUT"
env:
LATEST_RELEASE: ${{ steps.get-latest-tag.outputs.tag }}
outputs:
RELEASE_VERSION: ${{ steps.release-info.outputs.RELEASE_VERSION }}
PYTHON_VERSION: ${{ steps.release-info.outputs.PYTHON_VERSION }}
NEXT_TAG: ${{ steps.release-info.outputs.NEXT_TAG }}
create-new-release:
uses: ./.github/workflows/publish-to-pypi.yml
needs:
- version-check
if: ${{ needs.version-check.outputs.RELEASE_VERSION != needs.version-check.outputs.PYTHON_VERSION }}
with:
new-release-tag: ${{ needs.version-check.outputs.NEXT_TAG }}
secrets: inherit