Repository navigation
76 lines (66 loc) · 2.44 KB
/
Copy pathpublish.yml
File metadata and controls
76 lines (66 loc) · 2.44 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
# This workflow will build a binary distribution, with
# a version based on the current branch name.
# Artifacts are uploaded to PyPI,
# then a GitHub Release and a tag are created.
#
name: Create a Release and Publish to PyPI
on:
pull_request:
branches:
- main
types:
- closed
jobs:
build-n-publish:
name: Build and publish
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Build the binary wheel
run: |
pip install wheel
python setup.py bdist_wheel
- name: Check version match
id: check_version
run: |
BRANCH=${{ github.event.pull_request.head.ref }}
BRANCH_VERSION=${BRANCH#release_*}
VERSION=$(python setup.py --version)
echo $VERSION x $BRANCH_VERSION
if [[ $BRANCH_VERSION != $VERSION ]]; then
echo "Expecting version $VERSION, but branch is named $BRANCH"
exit 1
fi
echo "FUSION_VERSION=$VERSION" >> $GITHUB_ENV
- name: Publish distribution 📦 to PyPI
if: github.event.pull_request.merged == true
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Create a Github Release
if: github.event.pull_request.merged == true
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided automatically by Actions
with:
tag_name: v${{ env.FUSION_VERSION }}
release_name: Fusion - Release ${{ env.FUSION_VERSION }} (${{ github.event.repository.updated_at}})
body: |
Publishing release as [purefusion-${{ env.FUSION_VERSION }}](https://pypi.org/project/purefusion/)
draft: false
prerelease: false
- name: Upload Release Asset (tar.gz)
if: github.event.pull_request.merged == true
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/purefusion-${{ env.FUSION_VERSION }}-py3-none-any.whl
asset_name: purefusion-${{ env.FUSION_VERSION }}-py3-none-any.whl
asset_content_type: application/zip