Skip to content

Commit ee0680b

Browse files
committed
Use trusted publishing
1 parent e569d48 commit ee0680b

File tree

1 file changed

+51
-22
lines changed

1 file changed

+51
-22
lines changed

.github/workflows/release.yaml

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name: Release
22

3-
on:
4-
release:
5-
types: [released]
3+
on: [push]
4+
5+
concurrency:
6+
group: release
7+
cancel-in-progress: false
68

79
jobs:
810

911
release:
1012
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write
1313
container:
1414
image: danielflook/python-minifier-build:python3.11-2022-10-25
1515
steps:
@@ -18,32 +18,61 @@ jobs:
1818

1919
- name: Set version statically
2020
run: |
21-
VERSION=${{ github.event.release.tag_name }}
21+
VERSION=2.8.1
2222
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" setup.py
2323
24-
- name: Upload
25-
env:
26-
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
27-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
24+
- name: Build package
2825
run: |
29-
pip3 install --upgrade setuptools wheel twine
26+
pip3 install --upgrade setuptools wheel
3027
python3 setup.py sdist bdist_wheel --universal
31-
twine upload --non-interactive dist/*
28+
29+
- uses: actions/upload-artifact@v3
30+
with:
31+
name: dist
32+
path: dist/
33+
if-no-files-found: error
3234

3335
- name: Build documentation
3436
run: |
3537
pip3 install sphinx sphinxcontrib-programoutput sphinx_rtd_theme
3638
pip3 install dist/*.tar.gz
3739
sphinx-build docs/source /tmp/build
3840
39-
- name: Publish documentation
40-
uses: peaceiris/actions-gh-pages@v3
41+
- uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: /tmp/build
44+
45+
publish-to-pypi:
46+
needs: release
47+
runs-on: ubuntu-latest
48+
permissions:
49+
id-token: write
50+
environment:
51+
name: test-pypi
52+
url: https://pypi.org/project/python-minifier/
53+
steps:
54+
- uses: actions/download-artifact@v3
55+
with:
56+
name: dist
57+
path: dist/
58+
59+
- name: Publish package distributions to PyPI
60+
uses: pypa/gh-action-pypi-publish@release/v1
4161
with:
42-
github_token: ${{ secrets.GITHUB_TOKEN }}
43-
publish_dir: /tmp/build
44-
enable_jekyll: false
45-
force_orphan: true
46-
full_commit_message: |
47-
Update docs
48-
49-
[skip ci]
62+
repository-url: https://test.pypi.org/legacy/
63+
print-hash: true
64+
verbose: true
65+
66+
publish-docs:
67+
needs: release
68+
runs-on: ubuntu-latest
69+
permissions:
70+
pages: write
71+
id-token: write
72+
environment:
73+
name: github-pages
74+
url: ${{ steps.deployment.outputs.page_url }}
75+
steps:
76+
- name: Deploy to GitHub Pages
77+
id: deployment
78+
uses: actions/deploy-pages@v2

0 commit comments

Comments
 (0)