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

Redo versionning #237

Merged
merged 6 commits into from
Sep 1, 2023
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
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: CI
on:
pull_request:
push:
branches:
- 'v3'
branches: [main]

concurrency:
group: ${{ github.event_name }}-${{ github.ref }}
Expand Down
35 changes: 33 additions & 2 deletions .github/workflows/docker.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [v3]
branches: [main]

concurrency:
group: release

jobs:
push_to_registry:
push-to-registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
# Check if the tests were successful and were launched by a push event
Expand All @@ -31,3 +34,31 @@ jobs:
tags: ewjoachim/python-coverage-comment-action-base:v3
push: true
file: Dockerfile.build

compute-tags:
name: Re-tag action with new version
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
permissions:
contents: write
kieferro marked this conversation as resolved.
Show resolved Hide resolved

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Apply new tags
run: |
git fetch --tags origin
current="$(git describe --tags --abbrev=0 --match 'v*.*')"

major="$(echo $current | cut -d. -f1)"
minor="$(echo $current | cut -d. -f2)"

git tag -f ${major}
git push -f origin ${major}

# Major releases will be released manually.
patch=$((patch + 1))
new_tag="${major}.${minor}"

gh release create ${new_tag} --generate-notes
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ jobs:

By default, comments are generated from a
[Jinja](https://jinja.palletsprojects.com) template that you can read
[here](https://github.com/py-cov-action/python-coverage-comment-action/blob/v3/coverage_comment/template_files/comment.md.j2).
[here](https://github.com/py-cov-action/python-coverage-comment-action/blob/main/coverage_comment/template_files/comment.md.j2).

If you want to change this template, you can set `COMMENT_TEMPLATE`. This is
an advanced usage, so you're likely to run into more road bumps.
Expand Down Expand Up @@ -387,13 +387,13 @@ coverage (percentage) of the whole project from the PR build:

## Pinning

On the examples above, the version was set to `v3` (a branch). You can also pin
a specific version such as `v3.0.0` (a tag). There are still things left to
figure out in how to manage releases and version. If you're interested, please
open an issue to discuss this.

In terms of security/reproducibility, the best solution is probably to pin the
version to an exact tag, and use dependabot to update it regularly.
On the examples above, the version was set to the tag `v3`. Pinning to a major version
will give you the latest release on this version. (Note that we release everytime after
a PR is merged). Pinning to a specific version (`v3.1` for example) would make the
action more reproducible, though you'd have to update it regularly (e.g. using
Dependabot). You can also pin a commit hash if you want to be 100% sure of what you run,
given that tags are mutable. Finally, You can also decide to pin to main, if you're ok
with the action maybe breaking when (if) we release a v4.

## Note on the state of this action

Expand Down
2 changes: 1 addition & 1 deletion tests/end_to_end/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def token_other():

@pytest.fixture
def action_ref():
return os.environ.get("COVERAGE_COMMENT_E2E_ACTION_REF", "v3")
return os.environ.get("COVERAGE_COMMENT_E2E_ACTION_REF", "main")


@pytest.fixture
Expand Down
Loading