Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(all): Improve method to retrieve last tag #60

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
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
17 changes: 10 additions & 7 deletions .github/workflows/build_publish_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- "preminor"
- "premajor"
env:
DRAFT: ${{ contains(inputs.bump, 'pre') }}
PRERELEASE: ${{ contains(inputs.bump, 'pre') }}

jobs:
python_project:
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.DRAFT && 'vvatelot/ecoindex-api-backend:latest' || '' }}
tags: ${{ steps.meta.outputs.tags }},vvatelot/ecoindex-api-backend:${{ needs.python_project.outputs.api_version }},${{ !env.PRERELEASE && '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.DRAFT && 'vvatelot/ecoindex-api-worrker:latest' || '' }}
tags: ${{ steps.meta.outputs.tags }},vvatelot/ecoindex-api-worker:${{ needs.python_project.outputs.api_version }},${{ !env.PRERELEASE && 'vvatelot/ecoindex-api-worrker: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 @@ -196,9 +196,12 @@ jobs:
cp /tmp/pyproject.toml projects/ecoindex_api/pyproject.toml
cp /tmp/VERSION bases/ecoindex/backend/VERSION

- name: Get last tag (that is not a `pre` tag) for api
- uses: oprypin/find-latest-tag@v1
id: last_tag
run: echo "last_tag=$(git tag --list | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+@api$' | sort -r | head -n 1)" >> $GITHUB_OUTPUT
with:
repository: ${{ github.repository }}
releases-only: false
regex: '^v[0-9]+\.[0-9]+\.[0-9]+@api$'

- name: Commit files
uses: EndBug/add-and-commit@v9
Expand All @@ -214,7 +217,7 @@ jobs:
with:
token: ${{ github.token }}
fromTag: v${{ needs.python_project.outputs.api_version }}@api
toTag: ${{ steps.last_tag.outputs.last_tag }}
toTag: ${{ steps.last_tag.outputs.tag }}
excludeScopes: cli
changelogFilePath: /tmp/changelog.md

Expand All @@ -231,7 +234,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: ${{ env.DRAFT }}
prerelease: ${{ env.PRERELEASE }}
makeLatest: true
name: "API: v${{ needs.python_project.outputs.api_version }}"
tag: v${{ needs.python_project.outputs.api_version }}@api
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/build_publish_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- "preminor"
- "premajor"
env:
DRAFT: ${{ contains(inputs.bump, 'pre') }}
PRERELEASE: ${{ contains(inputs.bump, 'pre') }}

jobs:
python_project:
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.DRAFT && 'vvatelot/ecoindex-cli:latest' || '' }}
tags: ${{ steps.meta.outputs.tags }},vvatelot/ecoindex-cli:${{ needs.python_project.outputs.cli_version }},,${{ !env.PRERELEASE && '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 @@ -195,9 +195,12 @@ jobs:
cp /tmp/pyproject.toml projects/ecoindex_cli/pyproject.toml
cp /tmp/VERSION bases/ecoindex/cli/VERSION

- name: Get last tag (that is not a `pre` tag) for CLI
- uses: oprypin/find-latest-tag@v1
id: last_tag
run: echo "last_tag=$(git tag --list | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+@cli$' | sort -r | head -n 1)" >> $GITHUB_OUTPUT
with:
repository: ${{ github.repository }}
releases-only: false
regex: '^v[0-9]+\.[0-9]+\.[0-9]+@cli$'

- name: Commit files
uses: EndBug/add-and-commit@v9
Expand All @@ -213,7 +216,7 @@ jobs:
with:
token: ${{ github.token }}
fromTag: v${{ needs.python_project.outputs.cli_version }}@cli
toTag: ${{ steps.last_tag.outputs.last_tag }}
toTag: ${{ steps.last_tag.outputs.tag }}
excludeScopes: api
changelogFilePath: /tmp/changelog.md

Expand All @@ -232,7 +235,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: ${{ env.DRAFT }}
prerelease: ${{ env.PRERELEASE }}
makeLatest: true
name: "CLI: v${{ needs.python_project.outputs.cli_version }}"
tag: v${{ needs.python_project.outputs.cli_version }}@cli
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/build_publish_compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- "preminor"
- "premajor"
env:
DRAFT: ${{ contains(inputs.bump, 'pre') }}
PRERELEASE: ${{ contains(inputs.bump, 'pre') }}

jobs:
python_project:
Expand Down Expand Up @@ -152,9 +152,12 @@ jobs:
cp /tmp/pyproject.toml projects/ecoindex_compute/pyproject.toml
cp /tmp/VERSION components/ecoindex/compute/VERSION

- name: Get last tag (that is not a `pre` tag) for compute
- uses: oprypin/find-latest-tag@v1
id: last_tag
run: echo "last_tag=$(git tag --list | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+@compute$' | sort -r | head -n 1)" >> $GITHUB_OUTPUT
with:
repository: ${{ github.repository }}
releases-only: false
regex: '^v[0-9]+\.[0-9]+\.[0-9]+@compute$'

- name: Commit files
uses: EndBug/add-and-commit@v9
Expand All @@ -170,7 +173,7 @@ jobs:
with:
token: ${{ github.token }}
fromTag: v${{ needs.python_project.outputs.compute_version }}@compute
toTag: ${{ steps.last_tag.outputs.last_tag }}
toTag: ${{ steps.last_tag.outputs.tag }}
excludeScopes: api,cli,scraper
changelogFilePath: /tmp/changelog.md

Expand All @@ -185,7 +188,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: ${{ env.DRAFT }}
prerelease: ${{ env.PRERELEASE }}
makeLatest: true
name: "Compute: v${{ needs.python_project.outputs.compute_version }}"
tag: v${{ needs.python_project.outputs.compute_version }}@compute
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/build_publish_scraper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- "preminor"
- "premajor"
env:
DRAFT: ${{ contains(inputs.bump, 'pre') }}
PRERELEASE: ${{ contains(inputs.bump, 'pre') }}

jobs:
python_project:
Expand Down Expand Up @@ -152,9 +152,12 @@ jobs:
cp /tmp/pyproject.toml projects/ecoindex_scraper/pyproject.toml
cp /tmp/VERSION components/ecoindex/scraper/VERSION

- name: Get last tag (that is not a `pre` tag) for scraper
- uses: oprypin/find-latest-tag@v1
id: last_tag
run: echo "last_tag=$(git tag --list | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+@scraper$' | sort -r | head -n 1)" >> $GITHUB_OUTPUT
with:
repository: ${{ github.repository }}
releases-only: false
regex: '^v[0-9]+\.[0-9]+\.[0-9]+@scraper$'

- name: Commit files
uses: EndBug/add-and-commit@v9
Expand All @@ -170,7 +173,7 @@ jobs:
with:
token: ${{ github.token }}
fromTag: v${{ needs.python_project.outputs.scraper_version }}@scraper
toTag: ${{ steps.last_tag.outputs.last_tag }}
toTag: ${{ steps.last_tag.outputs.tag }}
excludeScopes: api,cli
changelogFilePath: /tmp/changelog.md

Expand All @@ -185,7 +188,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: ${{ env.DRAFT }}
prerelease: ${{ env.PRERELEASE }}
makeLatest: true
name: "Scraper: v${{ needs.python_project.outputs.scraper_version }}"
tag: v${{ needs.python_project.outputs.scraper_version }}@scraper
Expand Down
59 changes: 0 additions & 59 deletions .github/workflows/test_changelog.yml

This file was deleted.

Loading