File tree Expand file tree Collapse file tree 2 files changed +41
-43
lines changed Expand file tree Collapse file tree 2 files changed +41
-43
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
name : Deploy packages to PyPI and Anaconda
2
2
on :
3
- release :
4
- types : [released]
3
+ push :
4
+ tags :
5
+ - ' v*.*.*'
6
+ - ' v*.*'
5
7
jobs :
8
+
9
+ # Check that the tag matches the lastest version in the code
10
+ check-version :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - uses : actions/checkout@v4
14
+ - name : Check version
15
+ run : |
16
+ # Get the latest version from the code
17
+ latest_version=$(sed -r 's/__version__ = "(.*)"/\1/' ravenpackapi/version.py)
18
+ # Get the tag from the git tag
19
+ tag=$(echo $GITHUB_REF | sed -r 's/refs\/tags\/v(.*)/\1/')
20
+ # Check that the tag matches the latest version
21
+ if [ "$latest_version" != "$tag" ]; then
22
+ echo "The tag $tag does not match the latest version $latest_version"
23
+ exit 1
24
+ fi
25
+
6
26
# Build packages
7
27
build :
28
+ needs : check-version
8
29
uses : ./.github/workflows/build.yml
9
30
10
31
# Anaconda
60
81
path : dist/
61
82
- name : Publish package distributions to PyPI
62
83
uses : pypa/gh-action-pypi-publish@release/v1
84
+
85
+ # Create a release
86
+ github-release :
87
+ needs : deploy-pypi
88
+ name : >-
89
+ Create a GitHub Release
90
+ runs-on : ubuntu-latest
91
+ needs : check-version
92
+ steps :
93
+ - uses : actions/checkout@v4
94
+ - name : Dump the changelog
95
+ run : .github/changelogtext.sh > '${{ github.ref_name }}.md'
96
+ - name : Create GitHub Release
97
+ env :
98
+ GITHUB_TOKEN : ${{ github.token }}
99
+ run : |
100
+ latest_version=$(sed -r 's/__version__ = "(.*)"/\1/' ravenpackapi/version.py)
101
+ gh release create '${{ github.ref_name }}' -F '${{ github.ref_name }}.md' --title "Version $latest_version" --repo '${{ github.repository }}'
You can’t perform that action at this time.
0 commit comments