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

publish docker image to docker hub automatically when a release is done #58

Merged
merged 1 commit into from
Feb 5, 2023

Conversation

AlessandroMinoccheri
Copy link
Collaborator

I am using the same strategy in this repo:
https://github.com/phparkitect/arkitect/blob/main/.github/workflows/build.yml

So when a new release is created, GitHub Actions automatically push the docker image with a tag into the docker hub.
It's important to add in the repository two secrets: DOCKERHUB_USERNAME, DOCKERHUB_TOKEN

@AlessandroMinoccheri AlessandroMinoccheri added the enhancement New feature or request label Feb 3, 2023
@AlessandroMinoccheri AlessandroMinoccheri self-assigned this Feb 3, 2023
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v2
Copy link
Owner

Choose a reason for hiding this comment

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

v3 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I haven't already tried v3

Copy link
Owner

Choose a reason for hiding this comment

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

Should work without issues, but lets keep it for now

@OskarStark
Copy link
Owner

It's important to add in the repository two secrets: DOCKERHUB_USERNAME, DOCKERHUB_TOKEN

Done ✅

@OskarStark OskarStark merged commit be6de2b into master Feb 5, 2023
@OskarStark OskarStark deleted the publish-docker-on-release branch February 5, 2023 11:42
@OskarStark
Copy link
Owner

I will create a release

@OskarStark
Copy link
Owner

Hmm, do we need to change something here?

on:
    workflow_dispatch:
    schedule:
        - cron: '30 */4 * * *'

@AlessandroMinoccheri
Copy link
Collaborator Author

This is for the auto-commit I think.
So if a commit is done, the docker image should not be pushed because the trigger is a new release. Right?

@OskarStark
Copy link
Owner

Ok I triggered it manually for now, but an error occurred:

CleanShot 2023-02-06 at 05 25 45@2x

See:
https://github.com/OskarStark/phpstan-ga/actions/runs/4096399140

@AlessandroMinoccheri
Copy link
Collaborator Author

That image not exists I think, I changed our docker too, see this commit @OskarStark
phparkitect/arkitect-github-actions@7305e4e

@AlessandroMinoccheri
Copy link
Collaborator Author

PR:
#60

@OskarStark
Copy link
Owner

Hi @AlessandroMinoccheri, thanks again for this PR; I try to adapt it for the other repo in:
OskarStark/php-cs-fixer-ga#102

Unfortunately, I think because PHP-CS-Fixer uses v1.1.1 instead of 1.1.1 it cannot extract the version and the Workflow is failing:
https://github.com/OskarStark/php-cs-fixer-ga/actions/runs/6046366956

Maybe you can have a look and propose a PR? That would help me a lot, thank you!

BTW, I invited you as a collaborator, so that you can trigger the workflow manually!

Thanks in advance! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants