|
6 | 6 | branches: |
7 | 7 | - master |
8 | 8 | tags-ignore: |
9 | | - - '**' |
| 9 | + - "**" |
10 | 10 | # A release via GitHub releases will publish a stable version |
11 | 11 | release: |
12 | 12 | types: [published] |
13 | 13 | # Workflow dispatch will publish whatever you choose |
14 | 14 | workflow_dispatch: |
15 | 15 | inputs: |
16 | 16 | release_type: |
17 | | - description: 'Release type' |
| 17 | + description: Release type |
18 | 18 | required: true |
19 | 19 | type: choice |
20 | | - default: 'alpha' |
| 20 | + default: alpha |
21 | 21 | options: |
22 | | - - 'alpha' |
23 | | - - 'beta' |
24 | | - - 'final' |
| 22 | + - alpha |
| 23 | + - beta |
| 24 | + - final |
25 | 25 |
|
26 | 26 | jobs: |
27 | 27 | lint_and_type_checks: |
@@ -53,73 +53,73 @@ jobs: |
53 | 53 | url: https://pypi.org/p/apify-client |
54 | 54 |
|
55 | 55 | steps: |
56 | | - - name: Checkout repository |
57 | | - uses: actions/checkout@v3 |
58 | | - |
59 | | - - name: Set up Python |
60 | | - uses: actions/setup-python@v4 |
61 | | - with: |
62 | | - python-version: 3.8 |
63 | | - |
64 | | - - name: Install dependencies |
65 | | - run: make install-dev |
66 | | - |
67 | | - - # Determine if this is a prerelease or latest release |
68 | | - name: Determine release type |
69 | | - id: get-release-type |
70 | | - run: | |
71 | | - if [ ${{ github.event_name }} = release ]; then |
72 | | - release_type="final" |
73 | | - elif [ ${{ github.event_name }} = push ]; then |
74 | | - release_type="beta" |
75 | | - elif [ ${{ github.event_name }} = workflow_dispatch ]; then |
76 | | - release_type=${{ github.event.inputs.release_type }} |
77 | | - fi |
78 | | -
|
79 | | - if [ ${release_type} = final ]; then |
80 | | - docker_image_tag="latest" |
81 | | - elif [ ${release_type} = beta ]; then |
82 | | - docker_image_tag="beta" |
83 | | - else |
84 | | - docker_image_tag="" |
85 | | - fi |
86 | | -
|
87 | | - echo "release_type=${release_type}" >> $GITHUB_OUTPUT |
88 | | - echo "docker_image_tag=${docker_image_tag}" >> $GITHUB_OUTPUT |
89 | | -
|
90 | | - - # Check whether the released version is listed in CHANGELOG.md |
91 | | - name: Check whether the released version is listed in the changelog |
92 | | - if: steps.get-release-type.outputs.release_type != 'alpha' |
93 | | - run: make check-changelog-entry |
94 | | - |
95 | | - - # Check version consistency and increment pre-release version number for prereleases (must be the last step before build) |
96 | | - name: Bump pre-release version |
97 | | - if: steps.get-release-type.outputs.release_type != 'final' |
98 | | - run: python ./scripts/update_version_for_prerelease.py ${{ steps.get-release-type.outputs.release_type }} |
99 | | - |
100 | | - - # Build a source distribution and a python3-only wheel |
101 | | - name: Build distribution files |
102 | | - run: make build |
103 | | - |
104 | | - - # Check whether the package description will render correctly on PyPI |
105 | | - name: Check package rendering on PyPI |
106 | | - run: make twine-check |
107 | | - |
108 | | - - # Publish package to PyPI using their official GitHub action |
109 | | - name: Publish package to PyPI |
110 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
111 | | - |
112 | | - - # Tag the current commit with the version tag if this is not made from the release event (releases are tagged with the release process) |
113 | | - name: Tag Version |
114 | | - if: github.event_name != 'release' |
115 | | - run: | |
116 | | - git_tag=v`python ./scripts/print_current_package_version.py` |
117 | | - git tag $git_tag |
118 | | - git push origin $git_tag |
119 | | -
|
120 | | - - # Upload the build artifacts to the release |
121 | | - name: Upload the build artifacts to release |
122 | | - if: github.event_name == 'release' |
123 | | - run: gh release upload ${{ github.ref_name }} dist/* |
124 | | - env: |
125 | | - GH_TOKEN: ${{ github.token }} |
| 56 | + - name: Checkout repository |
| 57 | + uses: actions/checkout@v3 |
| 58 | + |
| 59 | + - name: Set up Python |
| 60 | + uses: actions/setup-python@v4 |
| 61 | + with: |
| 62 | + python-version: 3.8 |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: make install-dev |
| 66 | + |
| 67 | + - # Determine if this is a prerelease or latest release |
| 68 | + name: Determine release type |
| 69 | + id: get-release-type |
| 70 | + run: | |
| 71 | + if [ ${{ github.event_name }} = release ]; then |
| 72 | + release_type="final" |
| 73 | + elif [ ${{ github.event_name }} = push ]; then |
| 74 | + release_type="beta" |
| 75 | + elif [ ${{ github.event_name }} = workflow_dispatch ]; then |
| 76 | + release_type=${{ github.event.inputs.release_type }} |
| 77 | + fi |
| 78 | +
|
| 79 | + if [ ${release_type} = final ]; then |
| 80 | + docker_image_tag="latest" |
| 81 | + elif [ ${release_type} = beta ]; then |
| 82 | + docker_image_tag="beta" |
| 83 | + else |
| 84 | + docker_image_tag="" |
| 85 | + fi |
| 86 | +
|
| 87 | + echo "release_type=${release_type}" >> $GITHUB_OUTPUT |
| 88 | + echo "docker_image_tag=${docker_image_tag}" >> $GITHUB_OUTPUT |
| 89 | +
|
| 90 | + - # Check whether the released version is listed in CHANGELOG.md |
| 91 | + name: Check whether the released version is listed in the changelog |
| 92 | + if: steps.get-release-type.outputs.release_type != 'alpha' |
| 93 | + run: make check-changelog-entry |
| 94 | + |
| 95 | + - # Check version consistency and increment pre-release version number for prereleases (must be the last step before build) |
| 96 | + name: Bump pre-release version |
| 97 | + if: steps.get-release-type.outputs.release_type != 'final' |
| 98 | + run: python ./scripts/update_version_for_prerelease.py ${{ steps.get-release-type.outputs.release_type }} |
| 99 | + |
| 100 | + - # Build a source distribution and a python3-only wheel |
| 101 | + name: Build distribution files |
| 102 | + run: make build |
| 103 | + |
| 104 | + - # Check whether the package description will render correctly on PyPI |
| 105 | + name: Check package rendering on PyPI |
| 106 | + run: make twine-check |
| 107 | + |
| 108 | + - # Publish package to PyPI using their official GitHub action |
| 109 | + name: Publish package to PyPI |
| 110 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 111 | + |
| 112 | + - # Tag the current commit with the version tag if this is not made from the release event (releases are tagged with the release process) |
| 113 | + name: Tag Version |
| 114 | + if: github.event_name != 'release' |
| 115 | + run: | |
| 116 | + git_tag=v`python ./scripts/print_current_package_version.py` |
| 117 | + git tag $git_tag |
| 118 | + git push origin $git_tag |
| 119 | +
|
| 120 | + - # Upload the build artifacts to the release |
| 121 | + name: Upload the build artifacts to release |
| 122 | + if: github.event_name == 'release' |
| 123 | + run: gh release upload ${{ github.ref_name }} dist/* |
| 124 | + env: |
| 125 | + GH_TOKEN: ${{ github.token }} |
0 commit comments