-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (65 loc) · 1.96 KB
/
release.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
name: Release
on:
push:
branches:
- main
jobs:
release:
name: Create a GitHub Release
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version from package.json
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Create a GitHub Release (Fails if release already exists with same version number)
uses: actions/github-script@v7
env:
package-version: ${{ steps.package-version.outputs.current-version }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: 'v' + process.env['package-version'],
generate_release_notes: true,
});
build-and-publish:
needs: Release
name: Build and publish package to PyPI and TestPyPI
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: dash_react_components
environment-file: environment.yml
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Generate python files
run: npm install && npm run build
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}