-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (45 loc) · 1.59 KB
/
release.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: Build and Release
on:
push:
tags:
- 'v*.*.*' # Trigger on semantic versioning tags
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Get version from tag
id: vars
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel setuptools-scm
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Create Release
id: create_release
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
BRANCH_NAME=$(echo "${GITHUB_REF}" | sed 's/refs\/tags\///') # Correctly extract branch name
echo "Creating release for tag $TAG_NAME on branch $BRANCH_NAME"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Upload Package to Release
if: startsWith(github.ref, 'refs/tags/v') # Run this step if the tag starts with 'v'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG_NAME }} # Tag to create release
release_name: Release ${{ env.TAG_NAME }} from branch ${{ env.BRANCH_NAME }} # Include branch name in release title
files: |
dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}