-
Notifications
You must be signed in to change notification settings - Fork 50
96 lines (82 loc) · 2.67 KB
/
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: 3.12
- name: Install & Upgrade Pip
run: |
python -m pip install --upgrade pip
- name: Build package
run: |
python setup.py install
- name: Get versions into environment
run: |
VERSION=$(python setup.py --version)
TAG_VERSION=${GITHUB_REF##*/v}
TAG_FULL=${GITHUB_REF##*/}
echo "setup_version=$VERSION" >> $GITHUB_ENV
echo "tag_version=$TAG_VERSION" >> $GITHUB_ENV
echo "tag_full=$TAG_FULL" >> $GITHUB_ENV
- name: Compare versions and report
run: |
echo "setup.py version: ${{ env.setup_version }}"
echo "Latest tag version: ${{ env.tag_version }}"
if [[ ${{ env.setup_version }} != ${{ env.tag_version }} ]]; then
echo "Versions are not identical -> quitting workflow."
exit 23
else
echo "OK, versions match -> creating release."
exit 0
fi
- name: "Get latest release"
id: last_release
uses: InsonusK/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
exclude_types: ""
view_top: 1
- name: "Print latest release results"
run: |
echo "id: ${{ steps.last_release.outputs.id }}"
echo "name: ${{ steps.last_release.outputs.name }}"
echo "tag_name: ${{ steps.last_release.outputs.tag_name }}"
echo "created_at: ${{ steps.last_release.outputs.created_atd }}"
echo "draft: ${{ steps.last_release.outputs.draft }}"
echo "prerelease: ${{ steps.last_release.outputs.prerelease }}"
- name: "Check if release is existing"
id: check
run: |
if [[ "${{ steps.last_release.outputs.tag_name }}" == "${{ env.tag_full }}" ]];
then
echo "::set-output name=release_existing::true"
else
echo "::set-output name=release_existing::false"
fi
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.tag_version }}
release_name: v${{ env.tag_version }}
body: |
This is an autogenerated ${{ github.repository }} release.
Release notes coming soon...
## Improved / Changed
## New
## Fixed
## Notes
draft: false
prerelease: false
if: ${{ steps.check.outputs.release_existing == 'false' }}