1+ name :Release LocalStack Python Client
2+
3+ on :
4+ repository_dispatch :
5+ types :[release-sdk]
6+ workflow_dispatch :
7+ inputs :
8+ version :
9+ description :The version of the OpenAPI spec to release the client for
10+ required :true
11+
12+ env :
13+ git_user_name :localstack[bot]
14+ git_user_email :localstack-bot@users.noreply.github.com
15+
16+ jobs :
17+
18+ test_python :
19+ runs-on :ubuntu-latest
20+ env :
21+ release :${{ github.event_name == 'workflow_dispatch' && inputs.version || github.event.client_payload.version}}
22+
23+ steps :
24+ -name :" Pull image"
25+ run :|
26+ docker pull localstack/localstack-pro:${{ env.release }}
27+
28+ -name :" Checkout"
29+ uses :actions/checkout@v4
30+ with :
31+ # setuptools_scm requires git history to determine the version
32+ fetch-depth :0
33+
34+ -name :" Set up Python 3.11"
35+ uses :actions/setup-python@v5
36+ with :
37+ python-version :" 3.11"
38+
39+ -name :" Install uv"
40+ uses :astral-sh/setup-uv@v3
41+
42+ -name :" Generate code from spec"
43+ run :|
44+ make clean-generated
45+ ./bin/generate.sh ${{ env.release }}
46+
47+ -name :" Prepare git config"
48+ run :|
49+ git config user.name ${{ env.git_user_name }}
50+ git config user.email ${{ env.git_user_email }}
51+
52+ -name :" Commit changed code"
53+ run :|
54+ # Code automatically generated goes into the packages directory.
55+ # As we generate code for the version to be released, we commit those changes.
56+ if git status --porcelain packages/ | grep -q '^'; then
57+ git add packages/
58+ git commit -m "Generate code for ${{ env.release }}"
59+
60+ echo "Changes committed successfully"
61+ else
62+ echo "No changes detected after generating the code"
63+ fi
64+
65+ -name :" Install project"
66+ run :|
67+ make install-dev
68+
69+ -name :" Install LocalStack"
70+ run :|
71+ pip install localstack==${{ env.release }}
72+
73+ -name :" Start Localstack"
74+ env :
75+ LOCALSTACK_AUTH_TOKEN :${{ secrets.LOCALSTACK_AUTH_TOKEN }}
76+ run :|
77+ source .venv/bin/activate
78+ DEBUG=1 DISABLE_EVENTS="1" IMAGE_NAME="localstack/localstack-pro:${{ env.release }}" localstack start -d
79+ localstack wait -t 120 || (python -m localstack.cli.main logs && false)
80+
81+ -name :" Run Python Tests"
82+ env :
83+ LOCALSTACK_AUTH_TOKEN :${{ secrets.LOCALSTACK_AUTH_TOKEN }}
84+ run :|
85+ make test
86+
87+ -name :" Stop Localstack"
88+ if :success() || failure()
89+ run :|
90+ source .venv/bin/activate
91+ localstack logs
92+ localstack stop
93+
94+ -name :" Install release helper"
95+ run :|
96+ curl -o bin/release-helper.sh -L https://api.github.com/repos/localstack/localstack/contents/bin/release-helper.sh -H 'Accept: application/vnd.github.v3.raw'
97+ chmod +x bin/release-helper.sh
98+
99+ -name :" Create the release commit and tag"
100+ run :|
101+ bin/release-helper.sh git-commit-release ${{ env.release }}
102+
103+ -name :" Publish release to pypi"
104+ run :|
105+ make install publish
106+ with :
107+ UV_PUBLISH_TOKEN :${{ secrets.UV_PUBLISH_TOKEN }}
108+
109+ -name :" Push the release commit and tag"
110+ run :|
111+ git push --follow-tags
112+
113+ -name :" Create GitHub release"
114+ env :
115+ GITHUB_TOKEN :${{ secrets.LOCALSTACK_GITHUB_TOKEN }}
116+ run :gh release create "${{ env.release }}" --generate-notes --draft
117+
118+ -name :" Commit and push next development version"
119+ run :|
120+ bin/release-helper.sh git-commit-increment
121+ git push
122+
123+ -name :" Publish development version to pypi"
124+ run :|
125+ make install publish
126+ with :
127+ UV_PUBLISH_TOKEN :${{ secrets.UV_PUBLISH_TOKEN }}
128+
129+ -name :" Show git modifications"
130+ run :|
131+ git log --oneline -n 4
132+ git show HEAD~1
133+ git show HEAD