forked from datajoint/.github
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (63 loc) · 2.49 KB
/
make_github_release.yaml
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
55
56
57
58
59
60
61
62
63
64
name: Deprecated:make_github_release
on:
workflow_call:
outputs:
release_upload_url:
value: ${{ jobs.make_github_release.outputs.gh_release_upload_url }}
jobs:
make_github_release:
runs-on: ubuntu-latest
outputs:
gh_release_upload_url: ${{ steps.get_release_upload_url.outputs.upload_url }}
steps:
- name: Deprecation Warning
run: |
echo "This action is deprecated. Please use the 'Semantic Release' reusable workflow instead."
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install setuptools before pyproject.toml
run: |
pip install setuptools
- name: Determine package version
run: |
PKG_NAME=$(python3 -c "print([p for p in __import__('setuptools').find_packages() if all([x not in p for x in ['.', 'tests']])][0])")
SDIST_PKG_NAME=$(echo ${PKG_NAME} | sed 's|_|-|g')
PKG_VERSION=$(cat ${PKG_NAME}/version.py | grep -oP '\d+\.\d+\.[a-z0-9]+')
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV
echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV
echo "SDIST_PKG_NAME=${SDIST_PKG_NAME}" >> $GITHUB_ENV
- name: Get changelog entry
id: changelog_reader
uses: guzman-raphael/changelog-reader-action@v5
with:
path: ./CHANGELOG.md
version: ${{env.PKG_VERSION}}
- name: Check if release already exists
id: check_release
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag: ${{steps.changelog_reader.outputs.version}}
continue-on-error: true
- name: Create GH release
if: steps.check_release.outputs.id == ''
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{steps.changelog_reader.outputs.version}}
release_name: ${{steps.changelog_reader.outputs.version}}
body: ${{steps.changelog_reader.outputs.changes}}
prerelease: ${{steps.changelog_reader.outputs.status == 'prereleased'}}
draft: ${{steps.changelog_reader.outputs.status == 'unreleased'}}
- name: Get release upload URL
id: get_release_upload_url
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag: ${{steps.changelog_reader.outputs.version}}