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 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
52 changes: 49 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
# Job to test if a new version is ready to be released
deliverability:
name: Check if a new version must be released
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
# The job is run only if the CI workflow succeeded
if: github.event.workflow_run.conclusion == 'success'
outputs:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
echo "::set-output name=delivery::allowed"
release:
name: Release a new version of the docker image
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
needs: deliverability
if: needs.deliverability.outputs.delivery == 'allowed'
steps:
Expand Down 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-20.04
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-20.04
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 @@ -31,7 +31,7 @@ jobs:
# Job that builds the image and upload it as an artifact
build:
name: Build the docker image
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build docker image
Expand Down
Loading