Push the Docker images to GitHub Container Registry. #1
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
env: | |
IMAGE_NAME_BACKEND: ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }} | |
IMAGE_NAME_LANDING: ghcr.io/${{ github.repository_owner }}/landing:${{ github.sha }} | |
IMAGE_NAME_PWA: ghcr.io/${{ github.repository_owner }}/pwa:${{ github.sha }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Get a tag for the images | |
run: echo "IMAGE_TAG=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build the backend image | |
run: docker build -t $IMAGE_NAME_BACKEND:$IMAGE_TAG | |
- name: Build the landing image | |
run: docker build -t $IMAGE_NAME_LANDING:$IMAGE_TAG | |
- name: Build the PWA image | |
run: docker build -t $IMAGE_NAME_PWA:$IMAGE_TAG | |
- name: Push the images | |
run: | | |
docker push $IMAGE_NAME_BACKEND:$IMAGE_TAG | |
docker push $IMAGE_NAME_LANDING:$IMAGE_TAG | |
docker push $IMAGE_NAME_PWA:$IMAGE_TAG |