Skip to content

Backend container tests #146

Backend container tests

Backend container tests #146

name: Backend container tests
# wait until the 'Backend API tests' workflow has completed successfully before running this workflow
on:
workflow_run:
workflows: ["Backend API tests"]
types:
- completed
env:
CONTAINER_TAG: v0.${{ github.run_number }}
REGISTRY: ghcr.io
jobs:
build-and-push-image:
name: Build and push container to GHCR
if: ${{ github.event.workflow_run.conclusion == 'success' }} # verify the workflows specified above, ended in 'success' before continuing
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build Docker image
run: docker build ./backend -t ${{ env.REGISTRY }}/${{ github.actor }}/kubernetes-backend:${{ env.CONTAINER_TAG }}
- name: Login to GitHub Container Registry and push image
run: |
echo ${{ secrets.PACKAGES_TOKEN }} | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
docker push ${{ env.REGISTRY }}/${{ github.actor }}/kubernetes-backend:${{ env.CONTAINER_TAG }}