vechain / thor

A general purpose blockchain highly compatible with Ethereum's ecosystem
GNU Lesser General Public License v3.0
795 stars 248 forks source link

feat: publish docker images across different scenarios #680

Closed darrenvechain closed 3 months ago

darrenvechain commented 4 months ago

Description

This changes how we publish docker images:

  1. On commit to main:

    • Publish master-latest to GitHub Packages
    • Publish master-${date}-${short sha} to GitHub Packages
  2. On pre-release:

    • Publish vX.Y.Z-rc to GitHub Packages
    • Publish vX.Y.Z-rc to Docker Hub
  3. On release:

    • Publish vX.Y.Z to GitHub Packages
    • Publish vX.Y.Z to Docker Hub
    • Publish latest to GitHub Packages
    • Publish latest to Docker Hub

FYI For pre-releases, it's important to append the -rc and set it as a pre-release:

image

Type of change

How Has This Been Tested?

Please refer to the last 4 workflows here: https://github.com/darrenvechain/docker-publish-testing/actions

Checklist:

codecov-commenter commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 57.26%. Comparing base (e42227b) to head (4daeda1).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #680 +/- ## ========================================== - Coverage 57.27% 57.26% -0.02% ========================================== Files 156 156 Lines 17218 17218 ========================================== - Hits 9862 9860 -2 - Misses 6392 6394 +2 Partials 964 964 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

libotony commented 3 months ago

Do we do RC release on GitHub release? Usually, we would RC releases to production if it was tested ok. If we do RC release on GithHub, do we need to write release notes for both RC and production releases?

darrenvechain commented 3 months ago

Do we do RC release on GitHub release? Usually, we would RC releases to production if it was tested ok. If we do RC release on GithHub, do we need to write release notes for both RC and production releases?

@libotony you can chose the previous target when generating release notes, is this what you mean? See screenshot: image

BTW, the -rc is not mandatory, you can use any suffix you like and it will publish with that suffix, I guess the description just has the example

You can also see an example of releases here: https://github.com/darrenvechain/docker-publish-testing/releases

darrenvechain commented 3 months ago

Hey @libotony I added the linter to the master file. Another option (if we want) could be to always run the linter and tests before docker publish, like in this commit. WDYT? https://github.com/vechain/thor/commit/0e645b93d7a0fd42dac6313d6e304c59b4659ddc

I guess the good part is that tests and linters always run before docker publish. Bad part is that actions become nested and slightly harder to follow, eg see this PR: https://github.com/darrenvechain/thor/pull/26 - unit tests fall under Docker Publish which doesn't make much sense:

image
libotony commented 3 months ago

Hey @libotony I added the linter to the master file. Another option (if we want) could be to always run the linter and tests before docker publish, like in this commit. WDYT? 0e645b9

I think it's not necessary to run unit tests before docker publishes. I propose running linter on master is I remember that the linter action has a feature that only linting changed codes on PRs, so a full lint on master might be necessary.