Skip to content

Add screenshots from headless browser tests #6

Add screenshots from headless browser tests

Add screenshots from headless browser tests #6

Workflow file for this run

name: Build and Push Docker Image
on:
push:
tags:
- 'v*.*.*' # Triggers on version tags
workflow_dispatch: # Allows manual triggering
jobs:
wait_for_other_action:
runs-on: ubuntu-latest
steps:
- name: Wait for Other Action to Complete
id: check_status
run: |
# Set the necessary variables
WORKFLOW_NAME="Run Headless Browser Tests"
REPO="${{ github.repository }}" # Automatically get the repository name
BRANCH="${{ github.ref }}" # Get the ref, which includes refs/heads/main
# Loop until the workflow is complete
while true; do
# Query the GitHub API for the workflow run status
STATUS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$REPO/actions/workflows/${WORKFLOW_NAME}/runs?branch=${BRANCH}&per_page=1" | \
jq -r '.workflow_runs[0].status')
# Check if the status is completed
if [[ "$STATUS" == "completed" ]]; then
echo "Other action is complete."
break
fi
if [[ "$STATUS" == "failed" ]]; then
echo "Other action is faild."
exit 1 # Exit with error code
fi
echo "Waiting for other action to complete..."
sleep 10 # Wait for 10 seconds before checking again
done
build:
runs-on: ubuntu-latest
needs: wait_for_other_action # Ensure this job waits for the previous job to finish
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build Docker Image
run: |
docker build -t ghcr.io/toomanyfiles/tmf-timetable-frontend:${{ env.VERSION }} \
-t ghcr.io/toomanyfiles/tmf-timetable-frontend:latest .
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker Image with version and latest tags
run: |
docker push ghcr.io/toomanyfiles/tmf-timetable-frontend:${{ env.VERSION }}
docker push ghcr.io/toomanyfiles/tmf-timetable-frontend:latest