|
| 1 | +name: create-release-upload |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +env: |
| 9 | + CMAKE_VERSION: 3.17.2 |
| 10 | + XCODE_VERSION: 11.5 |
| 11 | + DOTNET_VERSION: 3.1.200 |
| 12 | + |
| 13 | +jobs: |
| 14 | + create-releases: |
| 15 | + name: create-releases |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: checkout |
| 20 | + uses: actions/checkout@v1 |
| 21 | + - name: Create Release |
| 22 | + id: create_release |
| 23 | + uses: actions/create-release@v1 |
| 24 | + env: |
| 25 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + with: |
| 27 | + tag_name: ${{ github.ref }} |
| 28 | + release_name: Release ${{ github.ref }} |
| 29 | + body: | |
| 30 | + Changes in this Release |
| 31 | + - First Change |
| 32 | + - Second Change |
| 33 | + draft: false |
| 34 | + prerelease: false |
| 35 | +# continue-on-error: true |
| 36 | + - name: write upload url |
| 37 | + env: |
| 38 | + url: ${{ steps.create_release.outputs.upload_url }} |
| 39 | + run: | |
| 40 | + echo $url > upload_url.txt |
| 41 | + - name: upload artifact |
| 42 | + uses: actions/upload-artifact@v1 |
| 43 | + with: |
| 44 | + name: artifact-upload_url |
| 45 | + path: upload_url.txt |
| 46 | + |
| 47 | + upload-object-windows-mingw: |
| 48 | + name: upload-object-win-mingw |
| 49 | + needs: create-releases |
| 50 | + runs-on: windows-latest |
| 51 | + |
| 52 | + steps: |
| 53 | + - name: setup dotnet |
| 54 | + uses: actions/setup-dotnet@v1 |
| 55 | + with: |
| 56 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 57 | + - name: checkout |
| 58 | + uses: actions/checkout@v2 |
| 59 | + - name: download artifact |
| 60 | + uses: actions/download-artifact@v1 |
| 61 | + with: |
| 62 | + name: artifact-upload_url |
| 63 | + - name: dump upload url |
| 64 | + id: get_url |
| 65 | + run: | |
| 66 | + export up_url="$(cat artifact-upload_url/upload_url.txt)" |
| 67 | + echo "::set-output name=upload_url::$up_url" |
| 68 | + echo "url=$up_url" |
| 69 | + shell: bash |
| 70 | + - name: Get the version |
| 71 | + id: get_version |
| 72 | + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} |
| 73 | + shell: bash |
| 74 | + - name: dump version |
| 75 | + env: |
| 76 | + version: ${{ steps.get_version.outputs.VERSION }} |
| 77 | + run: echo "version=${version}" |
| 78 | + shell: bash |
| 79 | + - name: cmake-build |
| 80 | + run: | |
| 81 | + .\tools\build.bat |
| 82 | + .\tools\test.bat |
| 83 | + timeout-minutes: 20 |
| 84 | + - name: cmake-install |
| 85 | + shell: cmd |
| 86 | + run: | |
| 87 | + mkdir dist |
| 88 | + COPY /Y /B dotnet_project\CfdCsharpProject\bin\Release\netstandard2.1\cfdcs.* dist |
| 89 | + COPY /Y /B build\Release\* dist |
| 90 | + - name: create archive file |
| 91 | + run: | |
| 92 | + cd dist |
| 93 | + del gen_context.exe |
| 94 | + Compress-Archive -Path ./* -DestinationPath ../cfd.zip |
| 95 | + cd .. |
| 96 | + echo "---- dump zip file ----" |
| 97 | + dir . |
| 98 | + - name: Upload Release Asset |
| 99 | + id: upload-release-asset |
| 100 | + |
| 101 | + env: |
| 102 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 103 | + with: |
| 104 | + upload_url: ${{ steps.get_url.outputs.upload_url }} |
| 105 | + asset_path: ./cfd.zip |
| 106 | + asset_name: cfdcs-${{ steps.get_version.outputs.VERSION }}-win-dotnet${{env.DOTNET_VERSION}}-msvc2019-x86_64.zip |
| 107 | + asset_content_type: application/zip |
| 108 | + |
| 109 | + upload-object-ubuntu: |
| 110 | + name: upload-object-ubuntu |
| 111 | + needs: create-releases |
| 112 | + runs-on: ${{ matrix.os }} |
| 113 | + strategy: |
| 114 | + matrix: |
| 115 | + os: [ubuntu-18.04] |
| 116 | + |
| 117 | + steps: |
| 118 | + - name: setup dotnet |
| 119 | + uses: actions/setup-dotnet@v1 |
| 120 | + with: |
| 121 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 122 | + - name: checkout |
| 123 | + uses: actions/checkout@v1 |
| 124 | + - name: Get the version |
| 125 | + id: get_version |
| 126 | + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} |
| 127 | + - name: cmake-useCache-ubuntu |
| 128 | + uses: actions/cache@v1 |
| 129 | + id: cache |
| 130 | + with: |
| 131 | + path: cache/cmake |
| 132 | + key: ${{ runner.os }}-cmake-${{ env.CMAKE_VERSION }}-x64-0 |
| 133 | + restore-keys: | |
| 134 | + ${{ runner.os }}-cmake-${{ env.CMAKE_VERSION }}-x64- |
| 135 | + - name: cmake-download-ubuntu |
| 136 | + if: steps.cache.outputs.cache-hit != 'true' |
| 137 | + run: | |
| 138 | + mkdir -p cache/cmake |
| 139 | + cd cache/cmake |
| 140 | + wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz |
| 141 | + cd ../.. |
| 142 | + - name: cmake-setting-ubuntu |
| 143 | + run: | |
| 144 | + export cmake_file_name="cmake-$CMAKE_VERSION-Linux-x86_64" |
| 145 | + cd cache/cmake |
| 146 | + tar zxvf $cmake_file_name.tar.gz |
| 147 | + chmod +x $cmake_file_name/bin/cmake $cmake_file_name/bin/ctest |
| 148 | + export CURRENT_DIR=$(pwd) |
| 149 | + echo ::add-path::$CURRENT_DIR/$cmake_file_name/bin |
| 150 | + cd ../.. |
| 151 | + - name: cmake-build |
| 152 | + run: | |
| 153 | + ./tools/build.sh |
| 154 | + - name: test |
| 155 | + run: | |
| 156 | + ./tools/test.sh |
| 157 | + - name: create archive file |
| 158 | + run: | |
| 159 | + mkdir dist |
| 160 | + cp -rp build/Release/* dist |
| 161 | + cp -rp dotnet_project/CfdCsharpProject/bin/Release/netstandard2.1/cfdcs.* dist |
| 162 | + cd dist |
| 163 | + zip -r cfd.zip . |
| 164 | + echo "---- dump zip file ----" |
| 165 | + ls -l |
| 166 | + - name: download artifact |
| 167 | + uses: actions/download-artifact@v1 |
| 168 | + with: |
| 169 | + name: artifact-upload_url |
| 170 | + - name: dump upload url |
| 171 | + id: get_url |
| 172 | + run: | |
| 173 | + url=$(cat artifact-upload_url/upload_url.txt) |
| 174 | + echo ::set-output name=upload_url::$url |
| 175 | + - name: Upload Release Asset |
| 176 | + |
| 177 | + env: |
| 178 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 179 | + with: |
| 180 | + upload_url: ${{ steps.get_url.outputs.upload_url }} |
| 181 | + asset_path: ./dist/cfd.zip |
| 182 | + asset_name: cfdcs-${{ steps.get_version.outputs.VERSION }}-${{ matrix.os }}-dotnet${{env.DOTNET_VERSION}}-gcc-x86_64.zip |
| 183 | + asset_content_type: application/zip |
| 184 | + - name: ubuntu-after |
| 185 | + run: rm -rf cache/cmake/cmake-$CMAKE_VERSION-Linux-x86_64 |
| 186 | + |
| 187 | + upload-object-macos: |
| 188 | + name: upload-object-macos |
| 189 | + needs: create-releases |
| 190 | + runs-on: macos-latest |
| 191 | + |
| 192 | + steps: |
| 193 | + - name: setup dotnet |
| 194 | + uses: actions/setup-dotnet@v1 |
| 195 | + with: |
| 196 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 197 | + - name: checkout |
| 198 | + uses: actions/checkout@v1 |
| 199 | + - name: Get the version |
| 200 | + id: get_version |
| 201 | + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} |
| 202 | + - name: Select Xcode version |
| 203 | + run: sudo xcode-select -s '/Applications/Xcode_${{env.XCODE_VERSION}}.app/Contents/Developer' |
| 204 | + - name: Show Xcode version |
| 205 | + run: xcodebuild -version |
| 206 | + - name: cmake-build |
| 207 | + run: | |
| 208 | + ./tools/build.sh |
| 209 | + - name: test |
| 210 | + run: | |
| 211 | + ./tools/test.sh |
| 212 | + - name: create archive file |
| 213 | + run: | |
| 214 | + mkdir dist |
| 215 | + cp -rp build/Release/* dist |
| 216 | + cp -rp dotnet_project/CfdCsharpProject/bin/Release/netstandard2.1/cfdcs.* dist |
| 217 | + cd dist |
| 218 | + zip -r cfd.zip . |
| 219 | + echo "---- dump zip file ----" |
| 220 | + ls -l |
| 221 | + - name: download artifact |
| 222 | + uses: actions/download-artifact@v1 |
| 223 | + with: |
| 224 | + name: artifact-upload_url |
| 225 | + - name: dump upload url |
| 226 | + id: get_url |
| 227 | + run: | |
| 228 | + url=$(cat artifact-upload_url/upload_url.txt) |
| 229 | + echo ::set-output name=upload_url::$url |
| 230 | + - name: Upload Release Asset |
| 231 | + |
| 232 | + env: |
| 233 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 234 | + with: |
| 235 | + upload_url: ${{ steps.get_url.outputs.upload_url }} |
| 236 | + asset_path: ./dist/cfd.zip |
| 237 | + asset_name: cfdcs-${{ steps.get_version.outputs.VERSION }}-macos-dotnet${{env.DOTNET_VERSION}}-xcode${{env.XCODE_VERSION}}-gcc-x86_64.zip |
| 238 | + asset_content_type: application/zip |
| 239 | + |
0 commit comments