Skip to content

Commit

Permalink
ci(all): Fix docker image publish and add mattermost notification on …
Browse files Browse the repository at this point in the history
…release (#63)

* ci(all): Fix docker image publish

* chore(api): Bump API version to 3.4.1a0

* ci(all): Add mattermost notification on release

* chore(compute): Bump compute version to 5.6.0a0

* ci(all): Add mattermost notification on release

* ci(all): Test format mattermost notification

* ci(all): Test format mattermost notification

* chore(compute): Bump compute version to 5.8.0a0

* ci(all): Test format mattermost notification

* ci(all): Test format mattermost notification

* ci(all): Test format mattermost notification

* ci(all): Test format mattermost notification

* ci(all): Test format mattermost notification

* ci(all): Test format mattermost notification

* ci(all): Test format mattermost notification

* ci(all): Test format mattermost notification debug

* ci(all): Test format mattermost notification debug

* ci(all): Test format mattermost notification debug

* ci(all): Test format mattermost notification debug

* ci(all): Test format mattermost notification debug

* ci(all): Test format mattermost notification debug

* ci(all): Test format mattermost notification debug

---------

Co-authored-by: vvatelot <[email protected]>
  • Loading branch information
vvatelot and vvatelot authored Mar 2, 2024
1 parent 5365d44 commit e9b5deb
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 39 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/build_publish_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
wheel: ${{ steps.wheel.outputs.wheel }}
api_version: ${{ steps.version.outputs.api_version }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -71,15 +71,15 @@ jobs:

- name: Output version
id: version
run: echo "api_version=$(task api:poetry:version-short)" >> $GITHUB_OUTPUT
run: echo "version=$(task api:poetry:version-short)" >> $GITHUB_OUTPUT

- name: Output wheel
id: wheel
run: echo "wheel=ecoindex_api-${{ steps.version.outputs.api_version }}-py3-none-any.whl" >> $GITHUB_OUTPUT
run: echo "wheel=ecoindex_api-${{ steps.version.outputs.version }}-py3-none-any.whl" >> $GITHUB_OUTPUT

- name: Output summary
run: |
echo "API version ${{ steps.version.outputs.api_version }}" >> $GITHUB_STEP_SUMMARY
echo "API version ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "Wheel ${{ steps.wheel.outputs.wheel }}" >> $GITHUB_STEP_SUMMARY
backend_image:
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
context: projects/ecoindex_api
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }},vvatelot/ecoindex-api-backend:${{ needs.python_project.outputs.api_version }},${{ !env.PRERELEASE && 'vvatelot/ecoindex-api-backend:latest' || '' }}
tags: ${{ steps.meta.outputs.tags }},vvatelot/ecoindex-api-backend:${{ needs.python_project.outputs.version }},${{ !contains(inputs.bump, 'pre') && 'vvatelot/ecoindex-api-backend:latest' || '' }}
labels: ${{ steps.meta.outputs.labels }}
file: projects/ecoindex_api/docker/backend/dockerfile
build-args: wheel=${{ needs.python_project.outputs.wheel }}
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
context: projects/ecoindex_api
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }},vvatelot/ecoindex-api-worker:${{ needs.python_project.outputs.api_version }},${{ !env.PRERELEASE && 'vvatelot/ecoindex-api-worrker:latest' || '' }}
tags: ${{ steps.meta.outputs.tags }},vvatelot/ecoindex-api-worker:${{ needs.python_project.outputs.version }},${{ !contains(inputs.bump, 'pre') && 'vvatelot/ecoindex-api-worker:latest' || '' }}
labels: ${{ steps.meta.outputs.labels }}
file: projects/ecoindex_api/docker/worker/dockerfile
build-args: wheel=${{ needs.python_project.outputs.wheel }}
Expand Down Expand Up @@ -206,8 +206,8 @@ jobs:
- name: Commit files
uses: EndBug/add-and-commit@v9
with:
message: "chore(api): Bump API version to ${{ needs.python_project.outputs.api_version }}"
tag: v${{ needs.python_project.outputs.api_version }}@api
message: "chore(api): Bump API version to ${{ needs.python_project.outputs.version }}"
tag: v${{ needs.python_project.outputs.version }}@api
tag_push: "--force"
push: true

Expand All @@ -216,27 +216,35 @@ jobs:
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: v${{ needs.python_project.outputs.api_version }}@api
fromTag: v${{ needs.python_project.outputs.version }}@api
toTag: ${{ steps.last_tag.outputs.tag }}
excludeScopes: cli
changelogFilePath: /tmp/changelog.md

- name: Update changelog content with dockerhub links
run: |
echo "${{ steps.changelog.outputs.changes }}" > /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "### Docker images" >> /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "Docker images have been built and pushed to Docker Hub. You can find them here:" >> /tmp/changelog.md
echo "- **Backend**: [vvatelot/ecoindex-api-backend:${{ needs.python_project.outputs.api_version }}](https://hub.docker.com/r/vvatelot/ecoindex-api-backend/tags?page=1&name=${{ needs.python_project.outputs.api_version }})" >> /tmp/changelog.md
echo "- **Worker**: [vvatelot/ecoindex-api-worker:${{ needs.python_project.outputs.api_version }}](https://hub.docker.com/r/vvatelot/ecoindex-api-worker/tags?page=1&name=${{ needs.python_project.outputs.api_version }})" >> /tmp/changelog.md
echo "- **Backend**: [vvatelot/ecoindex-api-backend:${{ needs.python_project.outputs.version }}](https://hub.docker.com/r/vvatelot/ecoindex-api-backend/tags?page=1&name=${{ needs.python_project.outputs.version }})" >> /tmp/changelog.md
echo "- **Worker**: [vvatelot/ecoindex-api-worker:${{ needs.python_project.outputs.version }}](https://hub.docker.com/r/vvatelot/ecoindex-api-worker/tags?page=1&name=${{ needs.python_project.outputs.version }})" >> /tmp/changelog.md
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: ${{ env.PRERELEASE }}
makeLatest: true
name: "API: v${{ needs.python_project.outputs.api_version }}"
tag: v${{ needs.python_project.outputs.api_version }}@api
name: "API: v${{ needs.python_project.outputs.version }}"
tag: v${{ needs.python_project.outputs.version }}@api
token: ${{ github.token }}
bodyFile: /tmp/changelog.md

- name: Notify to Mattermost
if: ${{ !env.PRERELEASE }}
run: |
echo -e "{\"icon_url\":\"https://icon-library.com/images/github-icon-png/github-icon-png-29.jpg\",\"text\":\":tada: Une nouvelle release a été publiée pour le projet **${{ github.repository }}: v${{ needs.python_project.outputs.version }}** :tada:\n\nPlus d'infos ici: ${{ steps.create_release.outputs.html_url }}\"}" > mattermost.json
curl -X POST -H 'Content-Type: application/json' -d @mattermost.json ${{ secrets.MATTERMOST_RELEASE_URL }}
32 changes: 20 additions & 12 deletions .github/workflows/build_publish_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
wheel: ${{ steps.wheel.outputs.wheel }}
cli_version: ${{ steps.version.outputs.cli_version }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -71,15 +71,15 @@ jobs:

- name: Output version
id: version
run: echo "cli_version=$(task cli:poetry:version-short)" >> $GITHUB_OUTPUT
run: echo "version=$(task cli:poetry:version-short)" >> $GITHUB_OUTPUT

- name: Output wheel
id: wheel
run: echo "wheel=ecoindex_cli-${{ steps.version.outputs.cli_version }}-py3-none-any.whl" >> $GITHUB_OUTPUT
run: echo "wheel=ecoindex_cli-${{ steps.version.outputs.version }}-py3-none-any.whl" >> $GITHUB_OUTPUT

- name: Output summary
run: |
echo "CLI version ${{ steps.version.outputs.cli_version }}" >> $GITHUB_STEP_SUMMARY
echo "CLI version ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "Wheel ${{ steps.wheel.outputs.wheel }}" >> $GITHUB_STEP_SUMMARY
docker_image:
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
context: projects/ecoindex_cli
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }},vvatelot/ecoindex-cli:${{ needs.python_project.outputs.cli_version }},,${{ !env.PRERELEASE && 'vvatelot/ecoindex-cli:latest' || '' }}
tags: ${{ steps.meta.outputs.tags }},vvatelot/ecoindex-cli:${{ needs.python_project.outputs.version }},${{ !contains(inputs.bump, 'pre') && 'vvatelot/ecoindex-cli:latest' || '' }}
labels: ${{ steps.meta.outputs.labels }}
file: projects/ecoindex_cli/dockerfile
build-args: wheel=${{ needs.python_project.outputs.wheel }}
Expand Down Expand Up @@ -205,8 +205,8 @@ jobs:
- name: Commit files
uses: EndBug/add-and-commit@v9
with:
message: "chore(cli): Bump CLI version to ${{ needs.python_project.outputs.cli_version }}"
tag: v${{ needs.python_project.outputs.cli_version }}@cli
message: "chore(cli): Bump CLI version to ${{ needs.python_project.outputs.version }}"
tag: v${{ needs.python_project.outputs.version }}@cli
tag_push: "--force"
push: true

Expand All @@ -215,29 +215,37 @@ jobs:
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: v${{ needs.python_project.outputs.cli_version }}@cli
fromTag: v${{ needs.python_project.outputs.version }}@cli
toTag: ${{ steps.last_tag.outputs.tag }}
excludeScopes: api
changelogFilePath: /tmp/changelog.md

- name: Update changelog content with dockerhub links
run: |
echo "${{ steps.changelog.outputs.changes }}" > /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "### Docker image" >> /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "Docker image have been built and pushed to Docker Hub: [vvatelot/ecoindex-api-backend:${{ needs.python_project.outputs.cli_version }}](https://hub.docker.com/r/vvatelot/ecoindex-cli/tags?page=1&name=${{ needs.python_project.outputs.cli_version }})" >> /tmp/changelog.md
echo "Docker image have been built and pushed to Docker Hub: [vvatelot/ecoindex-api-backend:${{ needs.python_project.outputs.version }}](https://hub.docker.com/r/vvatelot/ecoindex-cli/tags?page=1&name=${{ needs.python_project.outputs.version }})" >> /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "### Pypi package" >> /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "Pypi package have been built and pushed to Pypi: [ecoindex-cli:${{ needs.python_project.outputs.cli_version }}](https://pypi.org/project/ecoindex-cli/${{ needs.python_project.outputs.cli_version }}/)" >> /tmp/changelog.md
echo "Pypi package have been built and pushed to Pypi: [ecoindex-cli:${{ needs.python_project.outputs.version }}](https://pypi.org/project/ecoindex-cli/${{ needs.python_project.outputs.version }}/)" >> /tmp/changelog.md
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: ${{ env.PRERELEASE }}
makeLatest: true
name: "CLI: v${{ needs.python_project.outputs.cli_version }}"
tag: v${{ needs.python_project.outputs.cli_version }}@cli
name: "CLI: v${{ needs.python_project.outputs.version }}"
tag: v${{ needs.python_project.outputs.version }}@cli
token: ${{ github.token }}
bodyFile: /tmp/changelog.md

- name: Notify to Mattermost
if: ${{ !env.PRERELEASE }}
run: |
echo -e "{\"icon_url\":\"https://icon-library.com/images/github-icon-png/github-icon-png-29.jpg\",\"text\":\":tada: Une nouvelle release a été publiée pour le projet **${{ github.repository }}: v${{ needs.python_project.outputs.version }}** :tada:\n\nPlus d'infos ici: ${{ steps.create_release.outputs.html_url }}\"}" > mattermost.json
curl -X POST -H 'Content-Type: application/json' -d @mattermost.json ${{ secrets.MATTERMOST_RELEASE_URL }}
8 changes: 8 additions & 0 deletions .github/workflows/build_publish_compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,14 @@ jobs:

- name: Update changelog content with dockerhub links
run: |
echo "${{ steps.changelog.outputs.changes }}" > /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "### Pypi package" >> /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "Pypi package have been built and pushed to Pypi: [ecoindex-compute:${{ needs.python_project.outputs.compute_version }}](https://pypi.org/project/ecoindex-compute/${{ needs.python_project.outputs.compute_version }}/)" >> /tmp/changelog.md
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
Expand All @@ -194,3 +196,9 @@ jobs:
tag: v${{ needs.python_project.outputs.compute_version }}@compute
token: ${{ github.token }}
bodyFile: /tmp/changelog.md

- name: Notify to Mattermost
if: ${{ !env.PRERELEASE }}
run: |
echo "{\"icon_url\":\"https://icon-library.com/images/github-icon-png/github-icon-png-29.jpg\",\"text\":\":tada: Une nouvelle release a été publiée pour le projet **${{ github.repository }}: v${{ needs.python_project.outputs.compute_version }}** :tada:\n\nPlus d'infos ici: ${{ steps.create_release.outputs.html_url }}\"}" > mattermost.json
curl -X POST -H 'Content-Type: application/json' -d @mattermost.json ${{ secrets.MATTERMOST_RELEASE_URL }}
28 changes: 18 additions & 10 deletions .github/workflows/build_publish_scraper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
wheel: ${{ steps.wheel.outputs.wheel }}
scraper_version: ${{ steps.version.outputs.scraper_version }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -71,15 +71,15 @@ jobs:

- name: Output version
id: version
run: echo "scraper_version=$(task scraper:poetry:version-short)" >> $GITHUB_OUTPUT
run: echo "version=$(task scraper:poetry:version-short)" >> $GITHUB_OUTPUT

- name: Output wheel
id: wheel
run: echo "wheel=ecoindex_scraper-${{ steps.version.outputs.scraper_version }}-py3-none-any.whl" >> $GITHUB_OUTPUT
run: echo "wheel=ecoindex_scraper-${{ steps.version.outputs.version }}-py3-none-any.whl" >> $GITHUB_OUTPUT

- name: Output summary
run: |
echo "Scraper version ${{ steps.version.outputs.scraper_version }}" >> $GITHUB_STEP_SUMMARY
echo "Scraper version ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "Wheel ${{ steps.wheel.outputs.wheel }}" >> $GITHUB_STEP_SUMMARY
pypi_package:
Expand Down Expand Up @@ -162,8 +162,8 @@ jobs:
- name: Commit files
uses: EndBug/add-and-commit@v9
with:
message: "chore(scraper): Bump scraper version to ${{ needs.python_project.outputs.scraper_version }}"
tag: v${{ needs.python_project.outputs.scraper_version }}@scraper
message: "chore(scraper): Bump scraper version to ${{ needs.python_project.outputs.version }}"
tag: v${{ needs.python_project.outputs.version }}@scraper
tag_push: "--force"
push: true

Expand All @@ -172,25 +172,33 @@ jobs:
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: v${{ needs.python_project.outputs.scraper_version }}@scraper
fromTag: v${{ needs.python_project.outputs.version }}@scraper
toTag: ${{ steps.last_tag.outputs.tag }}
excludeScopes: api,cli
changelogFilePath: /tmp/changelog.md

- name: Update changelog content with dockerhub links
run: |
echo "${{ steps.changelog.outputs.changes }}" > /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "### Pypi package" >> /tmp/changelog.md
echo "" >> /tmp/changelog.md
echo "Pypi package have been built and pushed to Pypi: [ecoindex-scraper:${{ needs.python_project.outputs.scraper_version }}](https://pypi.org/project/ecoindex-scraper/${{ needs.python_project.outputs.scraper_version }}/)" >> /tmp/changelog.md
echo "Pypi package have been built and pushed to Pypi: [ecoindex-scraper:${{ needs.python_project.outputs.version }}](https://pypi.org/project/ecoindex-scraper/${{ needs.python_project.outputs.version }}/)" >> /tmp/changelog.md
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: ${{ env.PRERELEASE }}
makeLatest: true
name: "Scraper: v${{ needs.python_project.outputs.scraper_version }}"
tag: v${{ needs.python_project.outputs.scraper_version }}@scraper
name: "Scraper: v${{ needs.python_project.outputs.version }}"
tag: v${{ needs.python_project.outputs.version }}@scraper
token: ${{ github.token }}
bodyFile: /tmp/changelog.md

- name: Notify to Mattermost
if: ${{ !env.PRERELEASE }}
run: |
echo -e "{\"icon_url\":\"https://icon-library.com/images/github-icon-png/github-icon-png-29.jpg\",\"text\":\":tada: Une nouvelle release a été publiée pour le projet **${{ github.repository }}: v${{ needs.python_project.outputs.version }}** :tada:\n\nPlus d'infos ici: ${{ steps.create_release.outputs.html_url }}\"}" > mattermost.json
curl -X POST -H 'Content-Type: application/json' -d @mattermost.json ${{ secrets.MATTERMOST_RELEASE_URL }}
2 changes: 1 addition & 1 deletion bases/ecoindex/backend/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.0
3.4.1a0
2 changes: 1 addition & 1 deletion components/ecoindex/compute/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.5.0
5.8.0a0
2 changes: 1 addition & 1 deletion projects/ecoindex_api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ecoindex_api"
version = "3.4.0"
version = "3.4.1a0"
description = "REST API to expose Ecoindex"
authors = ['Vincent Vatelot <[email protected]>']
license = "Creative Commons BY-NC-ND"
Expand Down
2 changes: 1 addition & 1 deletion projects/ecoindex_compute/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ecoindex_compute"
version = "5.5.0"
version = "5.8.0a0"
readme = "README.md"
description = "Ecoindex module provides a simple way to measure the Ecoindex score based on the 3 parameters: The DOM elements of the page, the size of the page and the number of external requests of the page"
authors = ['Vincent Vatelot <[email protected]>']
Expand Down

1 comment on commit e9b5deb

@github-actions
Copy link

Choose a reason for hiding this comment

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

Coverage PR

Branch coverage •
FileStmtsMissCoverMissing
TOTAL69923067% 
report-only-changed-files is enabled. No files were changed during this commit :)

Please sign in to comment.