Skip to content

Commit

Permalink
without echo command
Browse files Browse the repository at this point in the history
  • Loading branch information
TimofeyTst committed Oct 8, 2023
1 parent e9f4ea7 commit de8ab5b
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ '*' ]

jobs:
build:
docker_setup:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -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:
Expand Down

0 comments on commit de8ab5b

Please sign in to comment.