Skip to content

Commit

Permalink
Use outputs to set image name
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyscientist committed Oct 17, 2023
1 parent c7b8cfb commit 74ba467
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/on_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on: [push]
jobs:
build-api:
runs-on: ubuntu-latest
outputs:
imagename: ${{ steps.image.name }}
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
Expand All @@ -15,12 +17,14 @@ jobs:
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: 'Build API image'
id: image
run: |
docker build backend/ \
--tag ghcr.io/${GITHUB_REPOSITORY,,}/api:${GITHUB_REF_NAME,,} \
--tag ghcr.io/${GITHUB_REPOSITORY,,}/api:latest
docker push ghcr.io/${GITHUB_REPOSITORY,,}/api:${GITHUB_REF_NAME,,}
docker push ghcr.io/${GITHUB_REPOSITORY,,}/api:latest
echo "name=${ghcr.io/${GITHUB_REPOSITORY,,}/api:${GITHUB_REF_NAME,,}}" >> $GITHUB_OUTPUT
build-ui:
runs-on: ubuntu-latest
steps:
Expand All @@ -42,7 +46,7 @@ jobs:
test:
needs: build-api
runs-on: ubuntu-latest
container: ghcr.io/${{GITHUB_REPOSITORY,,}}/api:${{GITHUB_REF_NAME,,}}
container: ${{ needs.build-api.outputs.imagename }}
services:
postgres:
image: postgres:latest
Expand Down

0 comments on commit 74ba467

Please sign in to comment.