-
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.
- Loading branch information
1 parent
e9f4ea7
commit de8ab5b
Showing
1 changed file
with
18 additions
and
15 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,7 +7,7 @@ on: | |
branches: [ '*' ] | ||
|
||
jobs: | ||
build: | ||
docker_setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
|
@@ -30,33 +30,36 @@ jobs: | |
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Determine Dockerfile | ||
id: dockerfile | ||
run: | | ||
if [ "$GITHUB_REF" == "refs/heads/prod" ]; then | ||
echo "Using Dockerfile.prod" | ||
echo "::set-output name=dockerfile::Dockerfile.prod" | ||
else | ||
echo "Using Dockerfile" | ||
echo "::set-output name=dockerfile::Dockerfile" | ||
fi | ||
|
||
|
||
build_and_push: | ||
needs: docker_setup | ||
if: github.ref != 'refs/heads/prod' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
file: ${{ steps.dockerfile.outputs.dockerfile }} | ||
file: Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
|
||
|
||
deploy: | ||
needs: build | ||
needs: docker_setup | ||
if: github.ref == 'refs/heads/prod' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
file: Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Trigger repo | ||
uses: convictional/[email protected] | ||
with: | ||
|