-
Notifications
You must be signed in to change notification settings - Fork 13
137 lines (117 loc) · 4.33 KB
/
release.yaml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Check & Release
on:
# Push to master will publish a beta version
push:
branches:
- master
tags-ignore:
- "**"
# A release via GitHub releases will publish a stable version
release:
types: [published]
# Workflow dispatch will publish whatever you choose
workflow_dispatch:
inputs:
release_type:
description: Release type
required: true
type: choice
default: alpha
options:
- alpha
- beta
- final
jobs:
should_release:
name: Check whether to release
if: (!startsWith(github.event.head_commit.message, 'docs:') || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
steps:
- name: Dummy step
run: true
lint_and_type_checks:
name: Run lint and type_checks
needs: [should_release]
uses: ./.github/workflows/lint_and_type_checks.yaml
unit_tests:
name: Run unit tests
needs: [should_release]
uses: ./.github/workflows/unit_tests.yaml
check_async_docstrings:
name: Check whether async dostrings are up to date
needs: [should_release]
uses: ./.github/workflows/check_async_docstrings.yaml
integration_tests:
name: Run integration tests
needs: [should_release]
uses: ./.github/workflows/integration_tests.yaml
secrets: inherit
publish_to_pypi:
name: Publish to PyPI
needs: [should_release, lint_and_type_checks, unit_tests, check_async_docstrings, integration_tests]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
environment:
name: pypi
url: https://pypi.org/p/apify-client
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: make install-dev
- # Determine if this is a prerelease or latest release
name: Determine release type
id: get-release-type
run: |
if [ ${{ github.event_name }} = release ]; then
release_type="final"
elif [ ${{ github.event_name }} = push ]; then
release_type="beta"
elif [ ${{ github.event_name }} = workflow_dispatch ]; then
release_type=${{ github.event.inputs.release_type }}
fi
if [ ${release_type} = final ]; then
docker_image_tag="latest"
elif [ ${release_type} = beta ]; then
docker_image_tag="beta"
else
docker_image_tag=""
fi
echo "release_type=${release_type}" >> $GITHUB_OUTPUT
echo "docker_image_tag=${docker_image_tag}" >> $GITHUB_OUTPUT
- # Check whether the released version is listed in CHANGELOG.md
name: Check whether the released version is listed in the changelog
if: steps.get-release-type.outputs.release_type != 'alpha'
run: make check-changelog-entry
- # Check version consistency and increment pre-release version number for prereleases (must be the last step before build)
name: Bump pre-release version
if: steps.get-release-type.outputs.release_type != 'final'
run: python ./scripts/update_version_for_prerelease.py ${{ steps.get-release-type.outputs.release_type }}
- # Build a source distribution and a python3-only wheel
name: Build distribution files
run: make build
- # Check whether the package description will render correctly on PyPI
name: Check package rendering on PyPI
run: make twine-check
- # Publish package to PyPI using their official GitHub action
name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- # Tag the current commit with the version tag if this is not made from the release event (releases are tagged with the release process)
name: Tag Version
if: github.event_name != 'release'
run: |
git_tag=v`python ./scripts/print_current_package_version.py`
git tag $git_tag
git push origin $git_tag
- # Upload the build artifacts to the release
name: Upload the build artifacts to release
if: github.event_name == 'release'
run: gh release upload ${{ github.ref_name }} dist/*
env:
GH_TOKEN: ${{ github.token }}