|
6 | 6 | - release/cli-* |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - build_test_package_release: |
10 | | - name: Build, test, package and release |
| 9 | + build_test_package: |
| 10 | + name: Build, test and package |
11 | 11 | strategy: |
12 | 12 | matrix: |
13 | 13 | os: [ 'windows-latest' ] |
|
20 | 20 |
|
21 | 21 | steps: |
22 | 22 | # - name: Check event payload |
| 23 | + # if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
23 | 24 | # shell: pwsh |
24 | 25 | # run: | |
25 | 26 | # echo ${{ toJSON(github.event) }} |
|
40 | 41 | echo "::set-output name=version::$version" |
41 | 42 |
|
42 | 43 | - name: Check release module and version |
| 44 | + if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
43 | 45 | shell: pwsh |
44 | 46 | run: | |
45 | 47 | # echo "env: $env:RELEASE_MODULE" |
|
49 | 51 | echo "output: ${{ steps.release.outputs.version }}" |
50 | 52 |
|
51 | 53 | - name: Checkout the repository |
| 54 | + if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
52 | 55 | uses: actions/checkout@v2 |
53 | 56 |
|
54 | 57 | # - name: Setup node.js |
| 58 | + # if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
55 | 59 | # uses: actions/setup-node@v1 |
56 | 60 | # with: |
57 | 61 | # node-version: ${{ matrix.node }} |
@@ -99,53 +103,155 @@ jobs: |
99 | 103 | shell: pwsh |
100 | 104 | run: | |
101 | 105 | dir |
102 | | - dotnet publish ./src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI -c Release -f ${{ matrix.targetFramework }} -p:PublishSingleFile=true --self-contained true -r ${{ matrix.runtime }} |
| 106 | + dotnet publish ./src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI -c Release -f ${{ matrix.targetFramework }} -r ${{ matrix.runtime }} -p:PublishSingleFile=true --self-contained true |
103 | 107 |
|
104 | 108 | - name: List Package for OpenApi.CLI |
105 | 109 | if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
106 | 110 | shell: pwsh |
107 | 111 | run: | |
108 | 112 | $sourcepath = "./src/*.OpenApi.CLI/bin/Release/${{ matrix.targetFramework }}/${{ matrix.runtime }}/publish" |
109 | 113 | $targetpath = "./src/*.OpenApi.CLI/bin/Release/${{ matrix.targetFramework }}/azfuncopenapi-v${{ steps.release.outputs.version }}-${{ matrix.targetFramework }}-${{ matrix.runtime }}.zip" |
110 | | - $package = Get-ChildItem -Path $sourcepath -Include *.* -Recurse | Compress-Archive -DestinationPath $targetpath |
| 114 | + $package = Get-ChildItem -Path $sourcepath -Recurse | Compress-Archive -DestinationPath $targetpath |
111 | 115 | $path = (Get-Item $targetpath).FullName |
112 | 116 | $name = (Get-Item $targetpath).Name |
113 | 117 |
|
114 | 118 | echo "::set-env name=PACKAGE_PATH::$path" |
115 | 119 | echo "::set-env name=PACKAGE_NAME::$name" |
116 | 120 |
|
117 | | - - name: Check release module and version |
| 121 | + - name: Check package path and name |
118 | 122 | if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
| 123 | + id: package |
119 | 124 | shell: pwsh |
120 | 125 | run: | |
121 | 126 | echo "package-path: $env:PACKAGE_PATH" |
122 | 127 | echo "package-name: $env:PACKAGE_NAME" |
123 | 128 |
|
124 | | - # - name: Create Release to GitHub |
125 | | - # if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
126 | | - # id: release |
127 | | - # uses: actions/create-release@v1 |
128 | | - # env: |
129 | | - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
130 | | - # with: |
131 | | - # tag_name: ${{ github.event.ref }} |
132 | | - # release_name: Release ${{ github.event.ref }} |
133 | | - # draft: false |
134 | | - # prerelease: false |
| 129 | + echo "::set-output name=path::$env:PACKAGE_PATH" |
| 130 | + echo "::set-output name=name::$env:PACKAGE_NAME" |
135 | 131 |
|
136 | | - # - name: Upload CLI to GitHub |
137 | | - # if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
138 | | - # uses: actions/upload-release-asset@v1 |
139 | | - # env: |
140 | | - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
141 | | - # with: |
142 | | - # upload_url: ${{ steps.release.outputs.upload_url }} |
143 | | - # asset_path: ${{ $PACKAGE_PATH }} |
144 | | - # asset_name: ${{ $PACKAGE_NAME }} |
145 | | - # asset_content_type: application/zip |
| 132 | + - name: Upload artifacts |
| 133 | + if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
| 134 | + uses: actions/upload-artifact@v2 |
| 135 | + with: |
| 136 | + name: cli |
| 137 | + path: "${{ steps.package.outputs.path }}" |
| 138 | + |
| 139 | + package_release: |
| 140 | + name: Release packages |
| 141 | + needs: build_test_package |
| 142 | + strategy: |
| 143 | + matrix: |
| 144 | + os: [ 'ubuntu-latest' ] |
| 145 | + node: [ 10 ] |
| 146 | + dotnet: [ '3.1.301' ] |
| 147 | + # targetFramework: [ 'net461', 'netcoreapp3.1' ] |
| 148 | + # runtime: [ 'win-x64', 'linux-x64', 'osx-x64' ] |
| 149 | + |
| 150 | + runs-on: ${{ matrix.os }} |
| 151 | + |
| 152 | + steps: |
| 153 | + - name: Download artifacts |
| 154 | + uses: actions/download-artifact@v2 |
| 155 | + with: |
| 156 | + name: cli |
| 157 | + path: artifacts |
| 158 | + |
| 159 | + - name: Get all artifacts |
| 160 | + id: package |
| 161 | + shell: pwsh |
| 162 | + run: | |
| 163 | + dir ./artifacts |
| 164 | +
|
| 165 | + $packages = Get-ChildItem -Path ./artifacts |
| 166 | +
|
| 167 | + $package0 = $packages[0].Name |
| 168 | + $package1 = $packages[1].Name |
| 169 | + $package2 = $packages[2].Name |
| 170 | + $package3 = $packages[3].Name |
| 171 | +
|
| 172 | + $version = $packages[0].Name.Split('-')[1].Replace("v", "") |
| 173 | +
|
| 174 | + echo "version: $version" |
| 175 | + echo "package0: $package0" |
| 176 | + echo "package1: $package1" |
| 177 | + echo "package2: $package2" |
| 178 | + echo "package3: $package3" |
| 179 | +
|
| 180 | + echo "::set-output name=version::$version" |
| 181 | + echo "::set-output name=package0::$package0" |
| 182 | + echo "::set-output name=package1::$package1" |
| 183 | + echo "::set-output name=package2::$package2" |
| 184 | + echo "::set-output name=package3::$package3" |
| 185 | +
|
| 186 | + - name: Repackage CLI for Linux and MacOS |
| 187 | + shell: bash |
| 188 | + run: | |
| 189 | + unzip "./artifacts/${{ steps.package.outputs.package1 }}" -d "./artifacts/linux" |
| 190 | + chmod +x ./artifacts/linux/azfuncopenapi |
| 191 | + ls -al ./artifacts/linux |
| 192 | + rm "./artifacts/${{ steps.package.outputs.package1 }}" |
| 193 | + zip -r -j "./artifacts/${{ steps.package.outputs.package1 }}" "./artifacts/linux" |
| 194 | +
|
| 195 | + unzip "./artifacts/${{ steps.package.outputs.package2 }}" -d "./artifacts/osx" |
| 196 | + chmod +x ./artifacts/osx/azfuncopenapi |
| 197 | + ls -al ./artifacts/osx |
| 198 | + rm "./artifacts/${{ steps.package.outputs.package2 }}" |
| 199 | + zip -r -j "./artifacts/${{ steps.package.outputs.package2 }}" "./artifacts/osx" |
| 200 | +
|
| 201 | + ls -al ./artifacts |
| 202 | +
|
| 203 | + - name: Create Release to GitHub |
| 204 | + id: ghrelease |
| 205 | + uses: actions/create-release@v1 |
| 206 | + env: |
| 207 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 208 | + with: |
| 209 | + tag_name: "cli-${{ steps.package.outputs.version }}" |
| 210 | + release_name: Release "cli-v${{ steps.package.outputs.version }}" |
| 211 | + draft: false |
| 212 | + prerelease: false |
| 213 | + |
| 214 | + - name: Upload CLI to GitHub - net461 win-x64 |
| 215 | + uses: actions/upload-release-asset@v1 |
| 216 | + env: |
| 217 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 218 | + with: |
| 219 | + upload_url: ${{ steps.ghrelease.outputs.upload_url }} |
| 220 | + asset_path: "artifacts/${{ steps.package.outputs.package0 }}" |
| 221 | + asset_name: ${{ steps.package.outputs.package0 }} |
| 222 | + asset_content_type: application/zip |
| 223 | + |
| 224 | + - name: Upload CLI to GitHub - netcoreapp3.1 linux-x64 |
| 225 | + uses: actions/upload-release-asset@v1 |
| 226 | + env: |
| 227 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 228 | + with: |
| 229 | + upload_url: ${{ steps.ghrelease.outputs.upload_url }} |
| 230 | + asset_path: "artifacts/${{ steps.package.outputs.package1 }}" |
| 231 | + asset_name: ${{ steps.package.outputs.package1 }} |
| 232 | + asset_content_type: application/zip |
| 233 | + |
| 234 | + - name: Upload CLI to GitHub - netcoreapp3.1 osx-x64 |
| 235 | + uses: actions/upload-release-asset@v1 |
| 236 | + env: |
| 237 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 238 | + with: |
| 239 | + upload_url: ${{ steps.ghrelease.outputs.upload_url }} |
| 240 | + asset_path: "artifacts/${{ steps.package.outputs.package2 }}" |
| 241 | + asset_name: ${{ steps.package.outputs.package2 }} |
| 242 | + asset_content_type: application/zip |
| 243 | + |
| 244 | + - name: Upload CLI to GitHub - netcoreapp3.1 win-x64 |
| 245 | + uses: actions/upload-release-asset@v1 |
| 246 | + env: |
| 247 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 248 | + with: |
| 249 | + upload_url: ${{ steps.ghrelease.outputs.upload_url }} |
| 250 | + asset_path: "artifacts/${{ steps.package.outputs.package3 }}" |
| 251 | + asset_name: ${{ steps.package.outputs.package3 }} |
| 252 | + asset_content_type: application/zip |
146 | 253 |
|
147 | 254 | # - name: Release to npm |
148 | | - # if: steps.release.outputs.module == 'cli' && ((matrix.targetFramework == 'net461' && matrix.runtime == 'win-x64') || matrix.targetFramework == 'netcoreapp3.1') |
149 | 255 | # uses: JS-DevTools/npm-publish@v1 |
150 | 256 | # with: |
151 | 257 | # token: ${{ secrets.NPM_TOKEN }} |
|
0 commit comments