|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + tags: [ '*' ] |
| 7 | + pull_request: |
| 8 | + branches: [ main ] |
| 9 | + |
| 10 | +env: |
| 11 | + DotNetVersion: "5.0.x" |
| 12 | + BuildConfiguration: "Release" |
| 13 | + BuildParameters: "Source/PabloDraw/PabloDraw.csproj /clp:NoSummary /p:Configuration=Release /p:BuildVersion=${{ github.run_id }} /p:BuildBranch=${{ github.ref }}" |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-windows: |
| 17 | + |
| 18 | + runs-on: windows-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + |
| 23 | + - uses: actions/setup-dotnet@v1 |
| 24 | + with: |
| 25 | + dotnet-version: ${{ env.DotNetVersion }} |
| 26 | + |
| 27 | + - run: dotnet publish ${{ env.BuildParameters }} -f net5.0-windows -r win-x64 |
| 28 | + |
| 29 | + - uses: actions/upload-artifact@v2 |
| 30 | + with: |
| 31 | + name: pablodraw-windows |
| 32 | + path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0-windows/win-x64/publish/* |
| 33 | + |
| 34 | + build-linux: |
| 35 | + |
| 36 | + runs-on: ubuntu-latest |
| 37 | + |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v2 |
| 40 | + |
| 41 | + - uses: actions/setup-dotnet@v1 |
| 42 | + with: |
| 43 | + dotnet-version: ${{ env.DotNetVersion }} |
| 44 | + |
| 45 | + - run: dotnet publish ${{ env.BuildParameters }} -f net5.0 -r linux-x64 |
| 46 | + |
| 47 | + - uses: actions/upload-artifact@v2 |
| 48 | + with: |
| 49 | + name: pablodraw-linux |
| 50 | + path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0/linux-x64/publish/* |
| 51 | + |
| 52 | + build-mac: |
| 53 | + |
| 54 | + runs-on: macos-latest |
| 55 | + |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v2 |
| 58 | + |
| 59 | + - uses: actions/setup-dotnet@v1 |
| 60 | + with: |
| 61 | + dotnet-version: ${{ env.DotNetVersion }} |
| 62 | + |
| 63 | + - uses: maxim-lobanov/setup-xamarin@v1 |
| 64 | + with: |
| 65 | + mono-version: latest |
| 66 | + xamarin-mac-version: latest |
| 67 | + xcode-version: latest |
| 68 | + |
| 69 | + # - name: Import code signing certificate |
| 70 | + # if: github.event_name != 'pull_request' |
| 71 | + # uses: apple-actions/import-codesign-certs@v1 |
| 72 | + # with: |
| 73 | + # p12-file-base64: ${{ secrets.DEVID_CERTIFICATE_P12 }} |
| 74 | + # p12-password: ${{ secrets.DEVID_CERTIFICATE_P12_PASSWORD }} |
| 75 | + |
| 76 | + # - name: Enable code signing |
| 77 | + # if: github.event_name != 'pull_request' |
| 78 | + # run: echo "BuildParameters=${{ env.BuildParameters }} /p:EnableCodeSignBuild=True" >> $GITHUB_ENV |
| 79 | + |
| 80 | + # - name: Set notarization credentials |
| 81 | + # if: startsWith(github.ref, 'refs/tags/') |
| 82 | + # run: | |
| 83 | + # xcrun altool --store-password-in-keychain-item "AC_PASSWORD" -u "${{ secrets.AC_USERNAME }}" -p "${{ secrets.AC_PASSWORD }}" |
| 84 | + # echo "BuildParameters=${{ env.BuildParameters }} /p:EnableNotarizationBuild=True" >> $GITHUB_ENV |
| 85 | + |
| 86 | + - run: dotnet build ${{ env.BuildParameters }} -f net5.0 -r osx-x64 |
| 87 | + |
| 88 | + - uses: actions/upload-artifact@v2 |
| 89 | + with: |
| 90 | + name: pablodraw-mac |
| 91 | + path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0/osx-x64/PabloDraw.dmg |
| 92 | + |
| 93 | + update-release: |
| 94 | + needs: [ build-windows, build-mac ] |
| 95 | + runs-on: ubuntu-latest |
| 96 | + if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) |
| 97 | + steps: |
| 98 | + - id: get_version |
| 99 | + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} |
| 100 | + |
| 101 | + - id: get_release |
| 102 | + uses: bruceadams/[email protected] |
| 103 | + env: |
| 104 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 105 | + |
| 106 | + - uses: actions/download-artifact@v2 |
| 107 | + with: |
| 108 | + name: pablodraw |
| 109 | + |
| 110 | + # - uses: actions/upload-release-asset@v1 |
| 111 | + # env: |
| 112 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 113 | + # with: |
| 114 | + # upload_url: ${{ steps.get_release.outputs.upload_url }} |
| 115 | + # asset_path: |
| 116 | + # asset_name: |
| 117 | + # asset_content_type: application/octet-stream |
0 commit comments