|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + runner: |
| 7 | + type: string |
| 8 | + default: '["base", "dind", "2204"]' |
| 9 | + runner-archs: |
| 10 | + type: string |
| 11 | + default: '["amd64", "arm64"]' |
| 12 | + runner-arch-map: |
| 13 | + type: string |
| 14 | + default: '[{"amd64":"x86_64", "arm64":"aarch64", "arm":"armv7l"}]' |
| 15 | + secrets: |
| 16 | + GIT_CLONE_PAT: |
| 17 | + required: false |
| 18 | + |
| 19 | + #pull_request: |
| 20 | + #branches: [ "main" ] |
| 21 | + #types: |
| 22 | + #- synchronize |
| 23 | + #- labeled |
| 24 | + |
| 25 | + workflow_dispatch: |
| 26 | + |
| 27 | +jobs: |
| 28 | + build: |
| 29 | + runs-on: ${{ format('{0}-{1}', join(fromJSON(inputs.runner), '-'), matrix.archconfig) }} |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + archconfig: ["${{ fromJSON(inputs.runner-archs) }}"] |
| 33 | + fail-fast: false |
| 34 | + |
| 35 | + steps: |
| 36 | + |
| 37 | + - name: Checkout code |
| 38 | + uses: actions/checkout@v3 |
| 39 | + |
| 40 | + - name: Display Go version |
| 41 | + run: | |
| 42 | + go version |
| 43 | +
|
| 44 | + - name: Find SHA |
| 45 | + run: | |
| 46 | + if [[ "${{github.event.pull_request.head.sha}}" != "" ]] |
| 47 | + then |
| 48 | + echo "ARTIFACT_SHA=$(echo ${{github.event.pull_request.head.ref}})" >> $GITHUB_ENV |
| 49 | + else |
| 50 | + echo "ARTIFACT_SHA=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV |
| 51 | + fi |
| 52 | +
|
| 53 | + - name: Build urunc binaries |
| 54 | + run: | |
| 55 | + make |
| 56 | +
|
| 57 | + - name: Upload urunc_aarch64 to S3 |
| 58 | + if: matrix.archconfig == 'aarch64' |
| 59 | + uses: cloudkernels/minio-upload@v3 |
| 60 | + with: |
| 61 | + url: https://s3.nbfc.io |
| 62 | + access-key: ${{ secrets.AWS_ACCESS_KEY }} |
| 63 | + secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 64 | + local-path: dist/urunc_static_arm64 |
| 65 | + remote-path: nbfc-assets/github/urunc/dist/${{ env.ARTIFACT_SHA }}/${{ matrix.archconfig }}/ |
| 66 | + policy: 1 |
| 67 | + |
| 68 | + - name: Upload urunc_amd64 to S3 |
| 69 | + if: matrix.archconfig == 'amd64' |
| 70 | + uses: cloudkernels/minio-upload@v3 |
| 71 | + with: |
| 72 | + url: https://s3.nbfc.io |
| 73 | + access-key: ${{ secrets.AWS_ACCESS_KEY }} |
| 74 | + secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 75 | + local-path: dist/urunc_static_amd64 |
| 76 | + remote-path: nbfc-assets/github/urunc/dist/${{ env.ARTIFACT_SHA }}/${{ matrix.archconfig }}/ |
| 77 | + policy: 1 |
| 78 | + |
| 79 | + - name: Upload containerd-shim-urunc-v2_aarch64 to S3 |
| 80 | + if: matrix.archconfig == 'aarch64' |
| 81 | + uses: cloudkernels/minio-upload@v3 |
| 82 | + with: |
| 83 | + url: https://s3.nbfc.io |
| 84 | + access-key: ${{ secrets.AWS_ACCESS_KEY }} |
| 85 | + secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 86 | + local-path: dist/containerd-shim-urunc-v2_arm64 |
| 87 | + remote-path: nbfc-assets/github/urunc/dist/${{ env.ARTIFACT_SHA }}/${{ matrix.archconfig }}/ |
| 88 | + policy: 1 |
| 89 | + |
| 90 | + - name: Upload containerd-shim-urunc-v2_amd64 to S3 |
| 91 | + if: matrix.archconfig == 'amd64' |
| 92 | + uses: cloudkernels/minio-upload@v3 |
| 93 | + with: |
| 94 | + url: https://s3.nbfc.io |
| 95 | + access-key: ${{ secrets.AWS_ACCESS_KEY }} |
| 96 | + secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 97 | + local-path: dist/containerd-shim-urunc-v2_amd64 |
| 98 | + remote-path: nbfc-assets/github/urunc/dist/${{ env.ARTIFACT_SHA }}/${{ matrix.archconfig }}/ |
| 99 | + policy: 1 |
0 commit comments