|
1 | 1 | name: Windows
|
2 | 2 |
|
3 |
| -on: [push] |
| 3 | +on: |
| 4 | + push: |
| 5 | + release: |
| 6 | + types: [published] |
4 | 7 |
|
5 | 8 | env:
|
6 | 9 | PHP_EXT: snappy
|
| 10 | + PHP_EXT_VERSION: ${{ github.event.release.tag_name }} |
7 | 11 | BIN_SDK_VER: 2.3.0
|
8 | 12 |
|
9 | 13 | jobs:
|
@@ -48,32 +52,81 @@ jobs:
|
48 | 52 | steps:
|
49 | 53 | - name: Checkout repository
|
50 | 54 | uses: actions/checkout@v4
|
| 55 | + with: |
| 56 | + persist-credentials: false |
51 | 57 |
|
52 | 58 | - name: Checkout submodule
|
53 | 59 | run: .\.github\workflows\submodule.ps1
|
| 60 | + shell: pwsh |
54 | 61 | if: ${{ matrix.library == '' }}
|
55 | 62 | - name: Install dependency library
|
56 | 63 | run: .\.github\workflows\vcpkg.ps1
|
| 64 | + shell: pwsh |
57 | 65 | env:
|
58 | 66 | VCPKG_LIBRARY: snappy
|
59 | 67 | if: ${{ matrix.library }}
|
60 | 68 |
|
| 69 | + - uses: actions/cache@v4 |
| 70 | + with: |
| 71 | + path: | |
| 72 | + C:\php\php-*.zip |
| 73 | + key: ${{ runner.os }}-php |
| 74 | + |
61 | 75 | - name: Install build command
|
62 | 76 | run: .\.github\workflows\install.ps1
|
| 77 | + shell: pwsh |
63 | 78 |
|
64 | 79 | - name: Build
|
65 | 80 | run: .\.github\workflows\build.ps1
|
| 81 | + shell: pwsh |
66 | 82 |
|
67 | 83 | - name: Test
|
68 | 84 | run: .\.github\workflows\test.ps1
|
| 85 | + shell: pwsh |
69 | 86 | env:
|
70 | 87 | REPORT_EXIT_STATUS: 1
|
71 | 88 | NO_INTERACTION: 1
|
72 | 89 |
|
73 |
| - - name: Store artifact DLL |
| 90 | + - if: ${{ github.event_name == 'release' }} |
| 91 | + name: Archive DLL |
| 92 | + run: |- |
| 93 | + Copy-Item .\php_${{ env.PHP_EXT }}.dll .\$env:EXT_NAME.dll |
| 94 | + Compress-Archive -Path .\$env:EXT_NAME.dll -Destination .\$env:EXT_NAME.zip |
| 95 | + shell: pwsh |
| 96 | + env: |
| 97 | + EXT_NAME: php_${{ env.PHP_EXT }}-${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }} |
| 98 | + |
| 99 | + - if: ${{ github.event_name == 'release' }} |
| 100 | + name: Store archive DLL |
74 | 101 | uses: actions/upload-artifact@v4
|
75 | 102 | with:
|
76 |
| - name: php_${{ env.PHP_EXT }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }} |
77 |
| - path: .\php_${{ env.PHP_EXT }}.dll |
| 103 | + name: ${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }} |
| 104 | + path: .\php_${{ env.PHP_EXT }}-${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}.zip |
78 | 105 | overwrite: true
|
79 |
| - if: ${{ matrix.library == '' }} |
| 106 | + |
| 107 | + release: |
| 108 | + permissions: |
| 109 | + contents: write |
| 110 | + needs: ci |
| 111 | + |
| 112 | + runs-on: ubuntu-latest |
| 113 | + |
| 114 | + if: ${{ github.event_name == 'release' }} |
| 115 | + |
| 116 | + steps: |
| 117 | + - name: Checkout |
| 118 | + uses: actions/checkout@v4 |
| 119 | + with: |
| 120 | + persist-credentials: false |
| 121 | + |
| 122 | + - name: Get artifacts |
| 123 | + uses: actions/download-artifact@v4 |
| 124 | + with: |
| 125 | + path: artifacts |
| 126 | + merge-multiple: true |
| 127 | + |
| 128 | + - name: Upload artifacts |
| 129 | + run: gh release upload ${{ env.PHP_EXT_VERSION }} artifacts/php* --clobber |
| 130 | + shell: bash |
| 131 | + env: |
| 132 | + GH_TOKEN: ${{ github.token }} |
0 commit comments