|
4 | 4 | pull_request: |
5 | 5 | push: |
6 | 6 | branches: [main] |
| 7 | + workflow_dispatch: |
7 | 8 |
|
8 | 9 | jobs: |
9 | 10 | build-and-test: |
|
13 | 14 | working-directory: "." |
14 | 15 | enable-cache: true |
15 | 16 | publish-crates-io: false |
| 17 | + |
| 18 | + prepare: |
| 19 | + name: Determine image tag |
| 20 | + runs-on: ubuntu-latest |
| 21 | + needs: build-and-test |
| 22 | + if: | |
| 23 | + github.ref_name == 'main' || |
| 24 | + startsWith(github.head_ref, 'feature/') || |
| 25 | + startsWith(github.head_ref, 'bugfix/') || |
| 26 | + (github.event_name == 'workflow_dispatch' && (startsWith(github.ref_name, 'feature/') || startsWith(github.ref_name, 'bugfix/'))) |
| 27 | + outputs: |
| 28 | + image_tag: ${{ steps.determine-tag.outputs.image_tag }} |
| 29 | + steps: |
| 30 | + - name: Determine Docker tag based on Git ref |
| 31 | + id: determine-tag |
| 32 | + run: | |
| 33 | + if [ "${{ github.event_name }}" = "pull_request" ] ; then |
| 34 | + SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8) |
| 35 | + else |
| 36 | + SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8) |
| 37 | + fi |
| 38 | +
|
| 39 | + if [ "${{ github.ref_name }}" = "main" ] ; then |
| 40 | + echo "Processing main branch" |
| 41 | + echo "image_tag=dev-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT |
| 42 | + else |
| 43 | + # This covers feature/ and bugfix/ branches |
| 44 | + echo "Processing feature/bugfix branch ${{ github.head_ref }}" |
| 45 | + echo "image_tag=feature-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT |
| 46 | + fi |
| 47 | +
|
| 48 | + post-compute-oci-image: |
| 49 | + name: post-compute OCI image |
| 50 | + needs: prepare |
| 51 | + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] |
| 52 | + with: |
| 53 | + image-name: docker-regis.iex.ec/tee-worker-post-compute-rust |
| 54 | + image-tag: ${{ needs.prepare.outputs.image_tag }} |
| 55 | + dockerfile: post-compute/Dockerfile |
| 56 | + context: . |
| 57 | + registry: docker-regis.iex.ec |
| 58 | + push: true |
| 59 | + security-scan: true |
| 60 | + security-report: "sarif" |
| 61 | + hadolint: true |
| 62 | + platforms: linux/amd64 |
| 63 | + secrets: |
| 64 | + username: ${{ secrets.NEXUS_USERNAME }} |
| 65 | + password: ${{ secrets.NEXUS_PASSWORD }} |
| 66 | + |
| 67 | + pre-compute-oci-image: |
| 68 | + name: pre-compute OCI image |
| 69 | + needs: prepare |
| 70 | + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] |
| 71 | + with: |
| 72 | + image-name: docker-regis.iex.ec/tee-worker-pre-compute-rust |
| 73 | + image-tag: ${{ needs.prepare.outputs.image_tag }} |
| 74 | + dockerfile: pre-compute/Dockerfile |
| 75 | + context: . |
| 76 | + registry: docker-regis.iex.ec |
| 77 | + push: true |
| 78 | + security-scan: true |
| 79 | + security-report: "sarif" |
| 80 | + hadolint: true |
| 81 | + platforms: linux/amd64 |
| 82 | + secrets: |
| 83 | + username: ${{ secrets.NEXUS_USERNAME }} |
| 84 | + password: ${{ secrets.NEXUS_PASSWORD }} |
0 commit comments