-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (76 loc) · 2.29 KB
/
release.yml
File metadata and controls
86 lines (76 loc) · 2.29 KB
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
name: Tag and Release OUROCODE on Merge to Main
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: true
push:
branches:
- main
jobs:
tag_and_release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install toml library
run: pip install toml
- name: Read version from pyproject.toml
id: get_version
run: |
VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build release distributions
run: |
# NOTE: put your own distribution build steps here.
python -m pip install build
python -m build
- name: Check if tag already exists
id: check_tag
run: |
if git ls-remote --tags origin v${{ env.VERSION }} | grep v${{ env.VERSION }}; then
echo "Tag already exists."
echo "TAG_EXISTS=true" >> $GITHUB_ENV
else
echo "Tag does not exist."
echo "TAG_EXISTS=false" >> $GITHUB_ENV
fi
- name: Create Tag
if: env.TAG_EXISTS == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag v${{ env.VERSION }}
git push origin v${{ env.VERSION }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.VERSION }}
name: Release v${{ env.VERSION }}
draft: false
prerelease: ${{ contains(env.VERSION, '-rc') || contains(env.VERSION, '-beta') }}
files: |
dist/*.whl
dist/*.tar.gz
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}