BREAKING CHANGE: update tag regex to match semver pattern `v[0-9]+.[0-9]+.[0-9]+`
This change separates the concerns of PyPI release and Docker image release into two separate workflows. The original `release.yml` file has been renamed to `PyPI Release` and now only handles the PyPI package release. A new `docker-release.yml` file has been created to handle the Docker image build and push.
Both workflows are now triggered on tags matching the semver pattern `v[0-9]+.[0-9]+.[0-9]+`, which corresponds to tags like `vX.Y.Z`. The Docker-related steps have been moved from the original workflow to the new Docker-specific workflow.
This change ensures that both PyPI and Docker releases are triggered on the same semver-compliant tag pattern, while separating the concerns of the two release processes.
# Aider chat conversation:
USER: do we need that under the `push:` too?
ASSISTANT: Yes, we should add the `paths-ignore` condition under the `push` event as well to ensure the workflows do not run if only files in the `website/` subtree are changed.
Here are the updated *SEARCH/REPLACE* blocks:
.github/workflows/windows-tests.yml
```yaml
<<<<<<< SEARCH
pull_request:
=======
pull_request:
paths-ignore:
- 'website/**'
>>>>>>> REPLACE
```
.github/workflows/windows-tests.yml
```yaml
<<<<<<< SEARCH
push:
=======
push:
paths-ignore:
- 'website/**'
>>>>>>> REPLACE
```
.github/workflows/docker-build-test.yml
```yaml
<<<<<<< SEARCH
pull_request:
=======
pull_request:
paths-ignore:
- 'website/**'
>>>>>>> REPLACE
```
.github/workflows/docker-build-test.yml
```yaml
<<<<<<< SEARCH
push:
=======
push:
paths-ignore:
- 'website/**'
>>>>>>> REPLACE
```
.github/workflows/ubuntu-tests.yml
```yaml
<<<<<<< SEARCH
pull_request:
=======
pull_request:
paths-ignore:
- 'website/**'
>>>>>>> REPLACE
```
.github/workflows/ubuntu-tests.yml
```yaml
<<<<<<< SEARCH
push:
=======
push:
paths-ignore:
- 'website/**'
>>>>>>> REPLACE
```
# Aider chat conversation:
USER: these workflows currently run on any changes to the main branch; they don't need to run if only files in the wubsite/ subtree are changed
ASSISTANT: To ensure the workflows do not run if only files in the `website/` subtree are changed, we can add a `paths-ignore` condition to each workflow. Here are the changes:
.github/workflows/windows-tests.yml
```yaml
<<<<<<< SEARCH
pull_request:
=======
pull_request:
paths-ignore:
- 'website/**'
>>>>>>> REPLACE
```
.github/workflows/docker-build-test.yml
```yaml
<<<<<<< SEARCH
pull_request:
=======
pull_request:
paths-ignore:
- 'website/**'
>>>>>>> REPLACE
```
.github/workflows/ubuntu-tests.yml
```yaml
<<<<<<< SEARCH
pull_request:
=======
pull_request:
paths-ignore:
- 'website/**'
>>>>>>> REPLACE
```
# Aider chat conversation:
USER: The workflow is not valid. .github/workflows/docker-build-test.yml (Line: 30, Col: 11): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKERHUB_USERNAME
ASSISTANT: ```diff
--- .github/workflows/docker-build-test.yml
+++ .github/workflows/docker-build-test.yml
@@ ... @@
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- if: ${{ secrets.DOCKERHUB_USERNAME }} && ${{ secrets.DOCKERHUB_PASSWORD }}
+ if: ${{ github.event_name != 'pull_request' || (secrets.DOCKERHUB_USERNAME && secrets.DOCKERHUB_PASSWORD) }}
```
This change corrects the conditional expression for the Docker login step by removing the incorrect `${{ }}` around `secrets.DOCKERHUB_USERNAME` and `secrets.DOCKERHUB_PASSWORD` and adding a check for the `github.event_name` to ensure that the login step is only executed when it's not a pull request or when the secrets are available.
# Aider chat conversation:
USER: please adjust this github action file so it will complete without failing if the dockerhub_username or password are not there
ASSISTANT: ```diff
--- .github/workflows/docker-build-test.yml
+++ .github/workflows/docker-build-test.yml
@@ ... @@
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
+ if: ${{ secrets.DOCKERHUB_USERNAME }} && ${{ secrets.DOCKERHUB_PASSWORD }}
```