|
53 | 53 | env:
|
54 | 54 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
55 | 55 |
|
56 |
| - deploy-tag-to-pypi: |
57 |
| - # only deploy on tags, see https://stackoverflow.com/a/58478262/1320237 |
58 |
| - if: startsWith(github.ref, 'refs/tags/v') |
59 |
| - needs: |
60 |
| - - run-tests |
61 |
| - runs-on: ubuntu-latest |
62 |
| - # This environment stores the TWINE_USERNAME and TWINE_PASSWORD |
63 |
| - # see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment |
64 |
| - environment: |
65 |
| - name: PyPI |
66 |
| - url: https://pypi.org/project/icalendar/ |
67 |
| - # after using the environment, we need to make the secrets available |
68 |
| - # see https://docs.github.com/en/actions/security-guides/encrypted-secrets#example-using-bash |
69 |
| - env: |
70 |
| - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} |
71 |
| - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |
72 |
| - steps: |
73 |
| - - uses: actions/checkout@v4 |
74 |
| - - name: Set up Python |
75 |
| - uses: actions/setup-python@v5 |
76 |
| - with: |
77 |
| - python-version: "3.9" |
78 |
| - - name: Install dependencies |
79 |
| - run: | |
80 |
| - python -m pip install --upgrade pip |
81 |
| - pip install wheel twine |
82 |
| - - name: Check the tag |
83 |
| - run: | |
84 |
| - PACKAGE_VERSION=`python setup.py --version` |
85 |
| - TAG_NAME=v$PACKAGE_VERSION |
86 |
| - echo "Package version $PACKAGE_VERSION with possible tag name $TAG_NAME on $GITHUB_REF_NAME" |
87 |
| - # test that the tag represents the version |
88 |
| - # see https://docs.github.com/en/actions/learn-github-actions/environment-variables |
89 |
| - if [ "$TAG_NAME" != "$GITHUB_REF_NAME" ]; then |
90 |
| - echo "ERROR: This tag is for the wrong version. Got \"$GITHUB_REF_NAME\" expected \"$TAG_NAME\"." |
91 |
| - exit 1 |
92 |
| - fi |
93 |
| - - name: remove old files |
94 |
| - run: rm -rf dist/* |
95 |
| - - name: build distribution files |
96 |
| - run: python setup.py bdist_wheel sdist |
97 |
| - - name: deploy to pypi |
98 |
| - run: | |
99 |
| - # You will have to set the variables TWINE_USERNAME and TWINE_PASSWORD |
100 |
| - # You can use a token specific to your project by setting the user name to |
101 |
| - # __token__ and the password to the token given to you by the PyPI project. |
102 |
| - # sources: |
103 |
| - # - https://shambu2k.hashnode.dev/gitlab-to-pypi |
104 |
| - # - http://blog.octomy.org/2020/11/deploying-python-pacakges-to-pypi-using.html?m=1 |
105 |
| - if [ -z "$TWINE_USERNAME" ]; then |
106 |
| - echo "WARNING: TWINE_USERNAME not set!" |
107 |
| - fi |
108 |
| - if [ -z "$TWINE_PASSWORD" ]; then |
109 |
| - echo "WARNING: TWINE_PASSWORD not set!" |
110 |
| - fi |
111 |
| - twine check dist/* |
112 |
| - twine upload dist/* |
113 |
| -
|
114 | 56 | deploy-github-release:
|
115 | 57 | # only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
|
116 | 58 | if: startsWith(github.ref, 'refs/tags/v')
|
|
123 | 65 | - uses: actions/checkout@v4
|
124 | 66 | - name: create release
|
125 | 67 | uses: elgohr/Github-Release-Action@v5
|
126 |
| - env: |
127 |
| - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
128 | 68 | with:
|
129 | 69 | title: ${{ github.ref_name }}
|
0 commit comments