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

Feature/push to docker hub #70

Merged
merged 4 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
48 changes: 47 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,57 @@ jobs:
tag_name: ${{ needs.deliverability.outputs.version }}
release_name: ${{ env.DOCKER_IMAGE_NAME }}:${{ needs.deliverability.outputs.version }}
body_path: changelog.md
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: deliverability
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.DOCKER_IMAGE_NAME }}}

- name: Build and push Docker image to version number
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE_FILENAME }}
push: true
tags: ${{ env.DOCKER_IMAGE_NAME}}:${{ needs.deliverability.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker image to lastest repo
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE_FILENAME }}
push: true
tags: ${{ env.DOCKER_IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}

close_milestone:
name: Close milestone
runs-on: ubuntu-latest
needs:
- push_to_registry
- release
- deliverability
steps:
# Close the milestone (that is now 100% completed)
- name: Close milestone
run: |
curl --request PATCH \
--url https://api.github.com/repos/${GITHUB_REPOSITORY}/milestones/${{ needs.deliverability.outputs.milestone_number }} \
--header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
--header 'Content-Type: application/json' \
--data '{"state":"closed"}'
--data '{"state":"closed"}'
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
# Job that tests the image
test:
name: Test the Docker image
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
Copy link
Member

Choose a reason for hiding this comment

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

Une bonne pratique est d'éviter les "latest" dans une intégration continue, cela permet d'avoir des CI reproductible, on va préférer figer une version (a minima, figer la version majeure pour bénificer des patchs de sécu tout de même)

Si besoin d'un ubuntu plus récent, tu peux mettre ubuntu-22.04 ou 23.10. ubuntu a de plus une sacré tendance a casser plein de trucs d'une version majeure a l'autre :)

needs: build
steps:
- uses: actions/checkout@v2
Expand Down
Loading