Refactored build to separate browser and electron and added docker bu… #28
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: cicd-main | |
on: | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-test: | |
uses: ./.github/workflows/build-and-test.yml | |
# Publish a test report using the playwright result files published in the previous step (execute in Linux only). | |
publish-playwright-test-report: | |
name: Publish PlayWright Test Report | |
needs: build-and-test | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
# Setup the GitHub Pages, if it doesn't exist yet. | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
# Download the test results artifacts. | |
- name: Download Test Results | |
uses: actions/download-artifact@v4 | |
with: | |
name: allure-results | |
path: allure-results | |
# Get the gh-pages history, so the next report can be generated with history. | |
- name: Get History | |
uses: actions/checkout@v4 | |
continue-on-error: true | |
with: | |
ref: gh-pages | |
path: gh-pages | |
# Generate the Allure Report | |
- name: Generate Allure Report | |
uses: simple-elf/allure-report-action@58e6590adf6d8f196a0d771bf8a00e6921086a62 # v.1.9 | |
with: | |
# Where to find the allure results. | |
allure_results: allure-results | |
# Where to publish the history. | |
allure_history: allure-history | |
keep_reports: 100 | |
# Subfolder in the destination. | |
subfolder: allure | |
# Where to find the gh-pages history. | |
gh_pages: gh-pages | |
# Upload allure-history report to github-pages artifact. | |
- name: Upload Pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'allure-history' | |
# Deploy the github-pages artifact to GitHub pages. | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
# Create Docker image with CrossModel web application. | |
docker: | |
# Only make the docker image when build and test succeeded. | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |