Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 31 additions & 56 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ on:
required: true

env:
git_user_name: localstack[bot]
git_user_email: localstack-bot@users.noreply.github.com
GIT_AUTHOR_NAME: localstack[bot]
GIT_AUTHOR_EMAIL: localstack-bot@users.noreply.github.com
GIT_COMMITTER_NAME: localstack[bot]
GIT_COMMITTER_EMAIL: localstack-bot@users.noreply.github.com

jobs:

test_python:
runs-on: ubuntu-latest
env:
release: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.event.client_payload.version}}
RELEASE_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.event.client_payload.version}}

steps:
- name: "Pull image"
run: |
docker pull localstack/localstack-pro:${{ env.release }}
- name: "Pull Image (localstack/localstack:${{ env.RELEASE_VERSION }})"
run: docker pull "localstack/localstack-pro:${RELEASE_VERSION}"

- name: "Checkout"
uses: actions/checkout@v4
Expand All @@ -39,94 +39,69 @@ jobs:
- name: "Install uv"
uses: astral-sh/setup-uv@v3

- name: "Generate code from spec"
- name: "Generate Code from Spec"
run: |
make clean-generated
./bin/generate.sh ${{ env.release }}
./bin/generate.sh ${RELEASE_VERSION}

- name: "Prepare git config"
run: |
git config user.name ${{ env.git_user_name }}
git config user.email ${{ env.git_user_email }}

- name: "Commit changed code"
- name: "Commit Changed Code"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we should try to commit the uv.lock file here as well. It's true that we won't get the same issue anymore downstream, but maybe it's good to keep it updated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand / have the full context here.
Does the pyproject.toml change here? If so, then the uv.lock file definitely needs to be updated (without upgrading the dependencies in there) and commited.

Everything else (like upgrading the versions in the uv.lock) should in my opinion not be part of the release workflow (way too fragile!), but should rather be handled with weekly updates proposed by dependabot (or any other kind of automation).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I am still not sure if I understood this correctly, also happy to jump on a huddle to discuss this directly / look at this together.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No pyproject.toml wouldn't change here. In the previous releases, we first tagged the release commit and then ran make install publish. uv.lock was unstaged, and this resulted in a dev version being pushed to PyPi. This should not happen anymore, but I was wondering when is a good time to commit an update to uv.lock. As you suggested, some sort of automation would be the best.

run: |
# Code automatically generated goes into the packages directory.
# As we generate code for the version to be released, we commit those changes.
if git status --porcelain packages/ | grep -q '^'; then
git add packages/
git commit -m "Generate code for ${{ env.release }}"
git commit -m "Generate code for ${RELEASE_VERSION}"

echo "Changes committed successfully"
else
echo "No changes detected after generating the code"
fi

- name: "Install project"
run: |
make install-dev
- name: "Install Project"
run: make install-dev

- name: "Install LocalStack"
run: |
pip install localstack==${{ env.release }}
run: pip install localstack==${RELEASE_VERSION}

- name: "Start Localstack"
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
run: |
source .venv/bin/activate
DEBUG=1 DISABLE_EVENTS="1" IMAGE_NAME="localstack/localstack-pro:${{ env.release }}" localstack start -d
localstack wait -t 120 || (python -m localstack.cli.main logs && false)
source .venv/bin/activate
DEBUG=1 DISABLE_EVENTS="1" IMAGE_NAME="localstack/localstack-pro:${RELEASE_VERSION}" localstack start -d
localstack wait -t 120 || (python -m localstack.cli.main logs && false)

- name: "Run Python Tests"
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
run: |
make test
run: make test

- name: "Stop Localstack"
if: success() || failure()
run: |
source .venv/bin/activate
localstack logs
localstack stop
source .venv/bin/activate
localstack logs
localstack stop

- name: "Install release helper"
- name: "Create the Release Commit and Tag"
run: |
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'
chmod +x bin/release-helper.sh
git commit --allow-empty -m "Release: v${RELEASE_VERSION}"
git tag -a "v${RELEASE_VERSION}" -m "Release: v${RELEASE_VERSION}"

- name: "Create the release commit and tag"
run: |
bin/release-helper.sh git-commit-release ${{ env.release }}
- name: "Push the release commit and tag"
run: git push --follow-tags

- name: "Publish release to pypi"
- name: "Publish Release to PyPi"
env:
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}
run: |
make install publish
run: make publish

- name: "Push the release commit and tag"
run: |
git push --follow-tags

- name: "Create GitHub release"
- name: "Create GitHub Release"
env:
GITHUB_TOKEN: ${{ secrets.LOCALSTACK_GITHUB_TOKEN }}
run: gh release create "v${{ env.release }}" --generate-notes --draft

- name: "Commit and push next development version"
run: |
bin/release-helper.sh git-commit-increment
git push

- name: "Publish development version to pypi"
env:
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}
run: |
make install publish
run: gh release create "v${RELEASE_VERSION}" --generate-notes

- name: "Show git modifications"
- name: "Show Git Modifications"
run: |
git log --oneline -n 4
git show HEAD~1
Expand Down