-
Notifications
You must be signed in to change notification settings - Fork 3
41 lines (41 loc) · 1.7 KB
/
test_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
name: CI
on:
push:
branches: [main, emnlp-code]
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/test.yml
pypi:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Pre-install setuptools_scm
run: python3 -m pip install --upgrade setuptools_scm
- name: Set a PyPI compatible setuptools_scm pretend version
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
# Required for continuously deploying to Test PyPI when we have commits not part of a tag/release
# See https://github.com/pypa/setuptools_scm/issues/478
# Snippet from: https://github.com/abhilash1in/paperplane/blob/1dfda182dc8a70fe08fa2284ea63b434246c394b/.github/workflows/CI.yml#L72-L84
run: |
from setuptools_scm import get_version
real_version = get_version()
pretend_version = get_version(local_scheme='no-local-version', version_scheme='post-release')
if pretend_version != real_version:
print(f'Setting SETUPTOOLS_SCM_PRETEND_VERSION to {pretend_version} instead of using version {real_version}')
print(f'::set-env name=SETUPTOOLS_SCM_PRETEND_VERSION::{pretend_version}')
else:
print(f'Version {real_version} is compatible with PyPI. No action needed.')
shell: python
- name: Build
run: python3 -m pip install --upgrade build && python3 -m build
- name: Publish distribution to test.PyPI.org
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TEST_TOKEN }}
repository-url: https://test.pypi.org/legacy/