-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Login dockerhub before pulling images
Signed-off-by: Tiago Góes <[email protected]>
- Loading branch information
1 parent
7379792
commit 627d816
Showing
1 changed file
with
30 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,42 +7,18 @@ env: | |
SHA: ${{ github.sha }} | ||
|
||
jobs: | ||
build-docker-image: | ||
run-api-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push todo-api | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/todo-api:${{ env.SHA }} | ||
|
||
- name: Build and push todo-db | ||
uses: docker/build-push-action@v6 | ||
with: | ||
file: Dockerfile.db | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/todo-db:${{ env.SHA }} | ||
|
||
api-tests: | ||
runs-on: ubuntu-latest | ||
needs: build-docker-image | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Start containers | ||
uses: hoverkraft-tech/[email protected] | ||
env: | ||
SHA: ${{ env.SHA }} | ||
|
||
- name: Run API tests | ||
run: | | ||
docker-compose up -d | ||
max_attempts=3 | ||
attempt=1 | ||
|
@@ -65,3 +41,30 @@ jobs: | |
- name: Test | ||
run: go test -v ./... | ||
|
||
build-push-docker-image: | ||
runs-on: ubuntu-latest | ||
needs: run-api-tests | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push todo-api | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/todo-api:${{ env.SHA }} | ||
|
||
- name: Build and push todo-db | ||
uses: docker/build-push-action@v6 | ||
with: | ||
file: Dockerfile.db | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/todo-db:${{ env.SHA }} | ||
|
||
|