Skip to content

Commit df0cbc6

Browse files
authored
Merge pull request #179 from knaaptime/release_action
2 parents e5b0d8a + 438d70e commit df0cbc6

File tree

2 files changed

+56
-43
lines changed

2 files changed

+56
-43
lines changed

.github/release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
authors:
6+
- dependabot
7+
categories:
8+
- title: Bug Fixes
9+
labels:
10+
- bug
11+
- title: Enhancements
12+
labels:
13+
- enhancement
14+
- title: Other Changes
15+
labels:
16+
- "*"
Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,50 @@
1-
2-
name: Release Package
1+
name: Release & Publish
32

43
on:
54
push:
65
# Sequence of patterns matched against refs/tags
76
tags:
8-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: Manual Release
12+
default: test
13+
required: false
14+
915

1016
jobs:
1117
build:
18+
name: Create release & publish to PyPI
1219
runs-on: ubuntu-latest
1320
steps:
14-
- uses: actions/checkout@v2
15-
- name: Set up Python
16-
uses: actions/setup-python@v2
17-
with:
18-
python-version: '3.x'
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
python -m pip install --upgrade build twine
23-
python -m build
24-
twine check --strict dist/*
25-
- name: Publish distribution 📦 to PyPI
26-
uses: pypa/gh-action-pypi-publish@release/v1
27-
with:
28-
password: ${{ secrets.pypi_password }}
29-
- name: Create Release
30-
id: create_release
31-
uses: actions/create-release@v1
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
34-
with:
35-
tag_name: ${{ github.ref }}
36-
release_name: Version ${{ github.ref }}
37-
draft: false
38-
prerelease: false
39-
- name: Get Asset name
40-
run: |
41-
export PKG=$(ls dist/)
42-
set -- $PKG
43-
echo "name=$1" >> $GITHUB_ENV
44-
- name: Upload Release Asset
45-
id: upload-release-asset
46-
uses: actions/upload-release-asset@v1
47-
env:
48-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
with:
50-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
51-
asset_path: dist/${{ env.name }}
52-
asset_name: ${{ env.name }}
53-
asset_content_type: application/zip
21+
- name: Checkout repo
22+
uses: actions/checkout@v3
23+
24+
- name: Set up python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: "3.x"
28+
29+
- name: Install Dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install --upgrade build twine
33+
python -m build
34+
twine check --strict dist/*
35+
36+
- name: Create Release Notes
37+
uses: actions/github-script@v6
38+
with:
39+
github-token: ${{secrets.GITHUB_TOKEN}}
40+
script: |
41+
await github.request(`POST /repos/${{ github.repository }}/releases`, {
42+
tag_name: "${{ github.ref }}",
43+
generate_release_notes: true
44+
});
45+
46+
- name: Publish distribution 📦 to PyPI
47+
uses: pypa/gh-action-pypi-publish@release/v1
48+
with:
49+
user: __token__
50+
password: ${{ secrets.PYPI_PASSWORD }}

0 commit comments

Comments
 (0)