|
| 1 | +name: "Build Windows Packages" |
| 2 | +run-name: "Build Windows Packages for ${{ inputs.ref }}" |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: "The version being built" |
| 9 | + type: string |
| 10 | + required: true |
| 11 | + ref: |
| 12 | + description: "The git reference to build" |
| 13 | + type: string |
| 14 | + required: true |
| 15 | + upload_release_assets: |
| 16 | + description: "Whether to upload assets to a GitHub release" |
| 17 | + type: boolean |
| 18 | + default: false |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + name: "Build DLL" |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + defaults: |
| 25 | + run: |
| 26 | + shell: cmd |
| 27 | + |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + os: [ "windows-2022" ] |
| 32 | + # Note: keep this in sync with the Windows matrix in tests.yml |
| 33 | + php-version: |
| 34 | + - "8.1" |
| 35 | + - "8.2" |
| 36 | + - "8.3" |
| 37 | + - "8.4" |
| 38 | + - "8.5" |
| 39 | + arch: [ x64, x86 ] |
| 40 | + ts: [ ts, nts ] |
| 41 | + |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + submodules: true |
| 46 | + ref: ${{ inputs.ref }} |
| 47 | + |
| 48 | + - name: "Build Driver" |
| 49 | + id: build-driver |
| 50 | + uses: ./.github/actions/windows/build |
| 51 | + with: |
| 52 | + ref: ${{ inputs.ref }} |
| 53 | + php-version: ${{ matrix.php-version }} |
| 54 | + arch: ${{ matrix.arch }} |
| 55 | + ts: ${{ matrix.ts }} |
| 56 | + run-tests: false |
| 57 | + |
| 58 | + sign-and-upload: |
| 59 | + environment: release |
| 60 | + name: "Sign and create package" |
| 61 | + needs: build |
| 62 | + runs-on: "ubuntu-latest" |
| 63 | + permissions: |
| 64 | + id-token: write |
| 65 | + |
| 66 | + steps: |
| 67 | + - name: "Generate token and checkout repository" |
| 68 | + uses: mongodb-labs/drivers-github-tools/secure-checkout@v2 |
| 69 | + with: |
| 70 | + app_id: ${{ vars.APP_ID }} |
| 71 | + private_key: ${{ secrets.APP_PRIVATE_KEY }} |
| 72 | + ref: ${{ inputs.ref }} |
| 73 | + |
| 74 | + - name: "Set up drivers-github-tools" |
| 75 | + uses: mongodb-labs/drivers-github-tools/setup@v2 |
| 76 | + with: |
| 77 | + aws_role_arn: ${{ secrets.AWS_ROLE_ARN }} |
| 78 | + aws_region_name: ${{ vars.AWS_REGION_NAME }} |
| 79 | + aws_secret_id: ${{ secrets.AWS_SECRET_ID }} |
| 80 | + |
| 81 | + - name: Get artifacts |
| 82 | + uses: actions/download-artifact@v5 |
| 83 | + with: |
| 84 | + path: artifacts |
| 85 | + pattern: php_mongodb-*.zip |
| 86 | + merge-multiple: true |
| 87 | + |
| 88 | + - name: "Create detached signatures for packages" |
| 89 | + uses: mongodb-labs/drivers-github-tools/gpg-sign@v2 |
| 90 | + with: |
| 91 | + filenames: php_mongodb*.zip |
| 92 | + |
| 93 | + - name: "Move signatures from release assets folder" |
| 94 | + run: | |
| 95 | + mv ${RELEASE_ASSETS}/php_mongodb*.sig artifacts/ |
| 96 | +
|
| 97 | + - name: "Upload assets to release" |
| 98 | + if: ${{ inputs.upload_release_assets }} |
| 99 | + run: | |
| 100 | + gh release upload ${{ inputs.version }} artifacts/php_mongodb* --clobber |
0 commit comments