-
-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (76 loc) · 2.28 KB
/
publish.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
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
name: Upload to Pypi
on:
workflow_dispatch: # Allow manual triggers
inputs:
tags:
description: 'Tags'
required: false
push:
# Publish `v1.2.3` tags as releases.
tags:
- v*
env:
# Change variable to your package name.
NAME: ibus_theme_tools
jobs:
# Pack Extension and Upload
push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Set up Python 3
uses: actions/setup-python@main
with:
python-version: '3.x'
- name: Setup Version
run: |
if [ ! -z "${{ github.event.inputs.tags }}" ]
then
version=${{ github.event.inputs.tags }}
echo "VERSION=${{ github.event.inputs.tags }}" >> $GITHUB_ENV
else
version=$(echo '${{ github.ref }}' | sed -e 's,.*/\(.*\),\1,')
echo "VERSION=$version" >> $GITHUB_ENV
fi
num=$(echo $version | sed -e 's/^v//')
echo "VERSION_NUM=$num" >> $GITHUB_ENV
- name: Install pypa/build
run: >-
python -m
pip install
build twine
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Check Build
run: >-
python -m
twine
check
dist/*
- name: Prepare for upload
run: |
cp dist/${{ env.NAME }}-${{ env.VERSION_NUM }}-*.whl ${{ env.NAME }}-${{ env.VERSION_NUM }}-py3-none-any.whl
- name: Upload Zipped Files to release
uses: svenstaro/upload-release-action@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.NAME }}-${{ env.VERSION_NUM }}-py3-none-any.whl
tag: ${{ env.VERSION }}
overwrite: true
- name: Upload Zipped Files to Artifact
uses: actions/upload-artifact@master
with:
name: ${{ env.NAME }}-${{ env.VERSION_NUM }}-py3-none-any.whl
path: ${{ env.NAME }}-${{ env.VERSION_NUM }}-py3-none-any.whl
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}