|
| 1 | +name: epiphany |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'main' ] |
| 6 | + paths: ['.github/workflows/epiphany.yml', 'epiphany/**'] |
| 7 | + pull_request: |
| 8 | + branches: [ 'main' ] |
| 9 | + paths: ['.github/workflows/epiphany.yml', 'epiphany/**'] |
| 10 | + workflow_call: |
| 11 | + inputs: |
| 12 | + build_main: |
| 13 | + description: "Build using liboqs and oqsprovider main branches" |
| 14 | + required: false |
| 15 | + default: false |
| 16 | + type: boolean |
| 17 | + release_tag: |
| 18 | + description: "Which docker tag to push to" |
| 19 | + required: false |
| 20 | + type: string |
| 21 | + workflow_dispatch: |
| 22 | + inputs: |
| 23 | + build_main: |
| 24 | + description: "Build using liboqs and oqsprovider main branches" |
| 25 | + required: false |
| 26 | + default: false |
| 27 | + type: boolean |
| 28 | + release_tag: |
| 29 | + description: "Which docker tag to push to" |
| 30 | + required: false |
| 31 | + type: string |
| 32 | + |
| 33 | +env: |
| 34 | + build-args: | |
| 35 | + LIBOQS_TAG=main |
| 36 | + OQSPROVIDER_TAG=main |
| 37 | + push: ${{ github.repository == 'open-quantum-safe/oqs-demos' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && inputs.build_main != 'true' }} |
| 38 | + |
| 39 | +jobs: |
| 40 | + build: |
| 41 | + strategy: |
| 42 | + fail-fast: false |
| 43 | + matrix: |
| 44 | + include: |
| 45 | + - arch: x86_64 |
| 46 | + runner: ubuntu-latest |
| 47 | + - arch: arm64 |
| 48 | + runner: ubuntu-24.04-arm |
| 49 | + runs-on: ${{ matrix.runner }} |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + - uses: docker/login-action@v3 |
| 53 | + if: env.push == 'true' |
| 54 | + with: |
| 55 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 56 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 57 | + - uses: docker/login-action@v3 |
| 58 | + with: |
| 59 | + registry: ghcr.io |
| 60 | + username: ${{ github.actor }} |
| 61 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + |
| 63 | + - name: Determine architecture |
| 64 | + id: arch |
| 65 | + run: echo "arch=$(uname -m)" >> $GITHUB_OUTPUT |
| 66 | + |
| 67 | + - name: Build the epiphany Docker image |
| 68 | + uses: docker/build-push-action@v6 |
| 69 | + with: |
| 70 | + load: true |
| 71 | + context: epiphany |
| 72 | + build-args: | |
| 73 | + ARCH=${{ steps.arch.outputs.arch }} |
| 74 | + ${{ (inputs.build_main == 'true') && env.build-args || null }} |
| 75 | + tags: oqs-epiphany |
| 76 | + |
| 77 | + - name: Scan Docker Image |
| 78 | + if: matrix.arch == 'x86_64' && env.push == 'true' |
| 79 | + |
| 80 | + with: |
| 81 | + image: oqs-epiphany |
| 82 | + command: cves,recommendations |
| 83 | + sarif-file: epiphany-scan-results.sarif |
| 84 | + |
| 85 | + - name: Upload Scan Results |
| 86 | + if: matrix.arch == 'x86_64' && env.push == 'true' |
| 87 | + |
| 88 | + with: |
| 89 | + name: epiphany-scan-results |
| 90 | + path: epiphany-scan-results.sarif |
| 91 | + |
| 92 | + - name: Push Docker image to registries |
| 93 | + if: env.push == 'true' |
| 94 | + uses: docker/build-push-action@v6 |
| 95 | + with: |
| 96 | + push: true |
| 97 | + context: epiphany |
| 98 | + build-args: | |
| 99 | + ${{ (inputs.build_main == 'true') && env.build-args || null }} |
| 100 | + tags: | |
| 101 | + ghcr.io/${{ github.repository_owner }}/epiphany:${{ inputs.release_tag || 'latest' }}-${{ matrix.arch }} |
| 102 | + openquantumsafe/epiphany:${{ inputs.release_tag || 'latest' }}-${{ matrix.arch }} |
| 103 | +
|
| 104 | + push: |
| 105 | + if: ${{ github.repository == 'open-quantum-safe/oqs-demos' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && inputs.build_main != 'true' }} |
| 106 | + needs: build |
| 107 | + uses: ./.github/workflows/push-manifest.yml |
| 108 | + secrets: inherit |
| 109 | + with: |
| 110 | + image_name: epiphany |
| 111 | + release_tag: ${{ inputs.release_tag || 'latest' }} |
0 commit comments