generated from brainelectronics/micropython-package-template
-
Notifications
You must be signed in to change notification settings - Fork 4
69 lines (64 loc) · 2.57 KB
/
test-release.yaml
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
---
# this file is *not* meant to cover or endorse the use of GitHub Actions, but
# rather to help make automated test releases for this project
name: Upload Python Package to test.pypi.org
on: [pull_request]
permissions:
contents: write
jobs:
test-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install build dependencies
run: |
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
- name: Build package
run: |
changelog2version \
--changelog_file changelog.md \
--version_file lcd_i2c/version.py \
--version_file_type py \
--additional_version_info="-rc${{ github.run_number }}.dev${{ github.event.number }}" \
--debug
python setup.py sdist
- name: Test built package
# sdist call creates non twine conform "*.orig" files, remove them
run: |
rm dist/*.orig
twine check dist/*.tar.gz
- name: Archive build package artifact
uses: actions/upload-artifact@v3
with:
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
# ${{ github.repository }} and ${{ github.ref_name }} can't be used
# for artifact name due to unallowed '/'
name: dist_repo.${{ github.event.repository.name }}_sha.${{ github.sha }}_build.${{ github.run_number }}
path: dist/*.tar.gz
retention-days: 14
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1.5
with:
repository_url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
skip_existing: true
verbose: true
print_hash: true
- name: 'Create changelog based prerelease'
uses: brainelectronics/changelog-based-release@v1
with:
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
# or you set the "contents" permissions to "write" as in this example
changelog-path: changelog.md
tag-name-prefix: ''
tag-name-extension: '-rc${{ github.run_number }}.dev${{ github.event.number }}'
release-name-prefix: ''
release-name-extension: '-rc${{ github.run_number }}.dev${{ github.event.number }}'
draft-release: true
prerelease: true