This repository has been archived by the owner on Jan 23, 2025. It is now read-only.
Bump Scalar.AspNetCore from 2.0.2 to 2.0.4 in /Pyro.Api #886
Workflow file for this run
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 Docker Image CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GCR: ghcr.io | |
IMAGE_NAME: sys27/pyro | |
DOCKERHUB_USERNAME: sys27 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
attestations: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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 | |
if: github.ref == format('refs/heads/{0}', 'master') | |
with: | |
username: ${{ env.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.GCR }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
name=${{ env.GCR }}/${{ env.IMAGE_NAME }},enable=true | |
name=${{ env.IMAGE_NAME }},enable=${{ github.ref == format('refs/heads/{0}', 'master') }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} | |
- name: Build images | |
uses: docker/build-push-action@v6 | |
env: | |
DOCKER_BUILD_SUMMARY: false | |
DOCKER_BUILD_RECORD_UPLOAD: false | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: . | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Export image to docker | |
id: build | |
uses: docker/build-push-action@v6 | |
env: | |
DOCKER_BUILD_SUMMARY: false | |
DOCKER_BUILD_RECORD_UPLOAD: false | |
with: | |
platforms: linux/amd64 | |
context: . | |
push: false | |
outputs: type=docker | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build tests | |
uses: docker/build-push-action@v6 | |
env: | |
DOCKER_BUILD_SUMMARY: false | |
DOCKER_BUILD_RECORD_UPLOAD: false | |
with: | |
platforms: linux/amd64 | |
context: . | |
target: test | |
push: false | |
outputs: type=docker | |
tags: tests-image | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Run tests | |
run: > | |
docker run --rm -t | |
--name tests | |
-e PYRO_IMAGE_ID=${{ steps.build.outputs.imageid }} | |
-e GITHUB_SERVER_URL=$GITHUB_SERVER_URL | |
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY | |
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE | |
-e GITHUB_SHA=$GITHUB_SHA | |
-e GITHUB_STEP_SUMMARY=/summary | |
-v /var/run/docker.sock:/var/run/docker.sock | |
-v $GITHUB_STEP_SUMMARY:/summary | |
tests-image | |
- name: Push | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ env.GCR }}/${{ env.IMAGE_NAME }} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |