|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + # build and publish in parallel: linux-arm,linux-x64,win-x86,win-x64,win-arm,osx-x64 |
| 15 | + dotnetos: [linux, win, osx] |
| 16 | + dotnetarch: [x86, x64, arm, arm64] |
| 17 | + exclude: |
| 18 | + - dotnetos: linux |
| 19 | + dotnetarch: x86 |
| 20 | + - dotnetos: osx |
| 21 | + dotnetarch: x86 |
| 22 | + - dotnetos: osx |
| 23 | + dotnetarch: arm |
| 24 | + - dotnetos: win |
| 25 | + dotnetarch: arm |
| 26 | + fail-fast: true |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v3 |
| 29 | + - name: environment prepare |
| 30 | + run: | |
| 31 | + sudo apt-get update |
| 32 | + sudo apt-get install -y apt-transport-https |
| 33 | + sudo apt-get update |
| 34 | + sudo apt-get install -y dotnet-sdk-7.0 |
| 35 | + sudo apt-get install -y p7zip-full |
| 36 | + - name: build |
| 37 | + env: |
| 38 | + DOTNETOS: ${{ matrix.dotnetos }} |
| 39 | + DOTNETARCH: ${{ matrix.dotnetarch }} |
| 40 | + run: | |
| 41 | + cd Image2Display/Image2Display |
| 42 | + dotnet publish -r $DOTNETOS-$DOTNETARCH --configuration Release -p:PublishSingleFile=true --self-contained true |
| 43 | + mkdir pkg |
| 44 | + mv bin/Release/net7.0/$DOTNETOS-$DOTNETARCH/publish/* pkg/ |
| 45 | +
|
| 46 | + - uses: actions/upload-artifact@v3 |
| 47 | + with: |
| 48 | + name: Image2Display-${{ matrix.dotnetos }}-${{ matrix.dotnetarch }} |
| 49 | + path: Image2Display/Image2Display/pkg/ |
| 50 | + |
| 51 | + publish: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: [build] |
| 54 | + permissions: |
| 55 | + contents: write |
| 56 | + steps: |
| 57 | + - uses: actions/download-artifact@v3 |
| 58 | + with: |
| 59 | + name: Image2Display-linux-arm |
| 60 | + path: Image2Display-linux-arm/ |
| 61 | + - uses: actions/download-artifact@v3 |
| 62 | + with: |
| 63 | + name: Image2Display-linux-arm64 |
| 64 | + path: Image2Display-linux-arm64/ |
| 65 | + - uses: actions/download-artifact@v3 |
| 66 | + with: |
| 67 | + name: Image2Display-linux-x64 |
| 68 | + path: Image2Display-linux-x64/ |
| 69 | + - uses: actions/download-artifact@v3 |
| 70 | + with: |
| 71 | + name: Image2Display-osx-x64 |
| 72 | + path: Image2Display-osx-x64/ |
| 73 | + - uses: actions/download-artifact@v3 |
| 74 | + with: |
| 75 | + name: Image2Display-win-arm64 |
| 76 | + path: Image2Display-win-arm64/ |
| 77 | + - uses: actions/download-artifact@v3 |
| 78 | + with: |
| 79 | + name: Image2Display-win-x64 |
| 80 | + path: Image2Display-win-x64/ |
| 81 | + - uses: actions/download-artifact@v3 |
| 82 | + with: |
| 83 | + name: Image2Display-win-x86 |
| 84 | + path: Image2Display-win-x86/ |
| 85 | + |
| 86 | + - name: Create Release Asset |
| 87 | + run: | |
| 88 | + cd Image2Display-linux-arm |
| 89 | + chmod +x ./Image2Display |
| 90 | + cd .. |
| 91 | + tar -cvf Image2Display-linux-arm.tar Image2Display-linux-arm/ |
| 92 | + cd Image2Display-linux-arm64 |
| 93 | + chmod +x ./Image2Display |
| 94 | + cd .. |
| 95 | + tar -cvf Image2Display-linux-arm64.tar Image2Display-linux-arm64/ |
| 96 | + cd Image2Display-linux-x64 |
| 97 | + chmod +x ./Image2Display |
| 98 | + cd .. |
| 99 | + tar -cvf Image2Display-linux-x64.tar Image2Display-linux-x64/ |
| 100 | + cd Image2Display-osx-x64 |
| 101 | + chmod +x ./Image2Display |
| 102 | + cd .. |
| 103 | + tar -cvf Image2Display-osx-arm64.tar Image2Display-osx-x64/ |
| 104 | + tar -cvf Image2Display-osx-x64.tar Image2Display-osx-x64/ |
| 105 | + zip -r Image2Display-win-arm64.zip Image2Display-win-arm64/ |
| 106 | + zip -r Image2Display-win-x64.zip Image2Display-win-x64/ |
| 107 | + zip -r Image2Display-win-x86.zip Image2Display-win-x86/ |
| 108 | +
|
| 109 | + - uses: ncipollo/release-action@v1 |
| 110 | + with: |
| 111 | + allowUpdates: true |
| 112 | + artifacts: "Image2Display-linux-arm.tar,Image2Display-linux-arm64.tar,Image2Display-linux-x64.tar,Image2Display-osx-arm64.tar,Image2Display-osx-x64.tar,Image2Display-win-arm64.zip,Image2Display-win-x64.zip,Image2Display-win-x86.zip" |
| 113 | + |
0 commit comments