build: refactor dependencies #3
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
name: Build and push | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "!.github/**" | |
- "!app/**" | |
- "!client/**" | |
- "!nginx/**" | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.PAT }} | |
- name: Extract metadata for api | |
id: api | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: | | |
${{ secrets.DOCKERHUB_USERNAME }}/short1url-api | |
ghcr.io/${{ github.repository }} | |
- name: Build and push api image | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./api | |
push: true | |
tags: ghcr.io/${{ github.repository }}-api:latest | |
labels: ${{ steps.api.outputs.labels }} | |
- name: Extract metadata for client | |
id: client | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: | | |
${{ secrets.DOCKERHUB_USERNAME }}/short1url-client | |
ghcr.io/${{ github.repository }} | |
- name: Build and push client image | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./client | |
push: true | |
tags: ghcr.io/${{ github.repository }}-client:latest | |
labels: ${{ steps.client.outputs.labels }} |