|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Setup .NET |
| 18 | + uses: actions/setup-dotnet@v1 |
| 19 | + with: |
| 20 | + dotnet-version: 9.0.x |
| 21 | + |
| 22 | + - name: Install dependencies |
| 23 | + run: dotnet restore |
| 24 | + |
| 25 | + - name: Build win-x64 |
| 26 | + run: dotnet publish SonarrAutoImport.sln -c Release --runtime win-x64 --self-contained -o SonarrAutoImport-win-x64 /p:AssemblyVersion=1.0.${{ github.run_number }} |
| 27 | + |
| 28 | + - name: Build linux-x64 |
| 29 | + run: dotnet publish SonarrAutoImport.sln -c Release --runtime linux-x64 --self-contained -o SonarrAutoImport-linux-x64 /p:AssemblyVersion=1.0.${{ github.run_number }} |
| 30 | + |
| 31 | + - name: Build osx-x64 |
| 32 | + run: dotnet publish SonarrAutoImport.sln -c Release --runtime osx-x64 --self-contained -o SonarrAutoImport-osx-x64 /p:AssemblyVersion=1.0.${{ github.run_number }} |
| 33 | + |
| 34 | + - name: Pack .NET Core tool |
| 35 | + run: dotnet pack -c Release SonarrAutoImport.sln /p:Version=1.0.${{ github.run_number }} |
| 36 | + |
| 37 | + - name: Pack executables |
| 38 | + shell: bash |
| 39 | + run: | |
| 40 | + 7z a -tzip "./artifacts/SonarrAutoImport-win-x64.zip" "./SonarrAutoImport-win-x64/*" |
| 41 | + tar czvf "./artifacts/SonarrAutoImport-linux-x64.tar.gz" "SonarrAutoImport-linux-x64" |
| 42 | + tar czvf "./artifacts/SonarrAutoImport-osx-x64.tar.gz" "SonarrAutoImport-osx-x64" |
| 43 | + rm -r "SonarrAutoImport-win-x64" |
| 44 | + rm -r "SonarrAutoImport-linux-x64" |
| 45 | + rm -r "SonarrAutoImport-osx-x64" |
| 46 | + |
| 47 | + - name: Create the Release |
| 48 | + id: create_release |
| 49 | + if: ${{ github.event_name == 'push' }} |
| 50 | + uses: actions/create-release@v1.1.3 |
| 51 | + env: |
| 52 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
| 53 | + with: |
| 54 | + tag_name: 1.0.${{ github.run_number }} |
| 55 | + release_name: Release 1.0.${{ github.run_number }} |
| 56 | + draft: false |
| 57 | + |
| 58 | + - name: Upload SonarrAutoImport-win-x64.zip |
| 59 | + if: ${{ github.event_name == 'push' }} |
| 60 | + uses: actions/upload-release-asset@v1.0.2 |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + with: |
| 64 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 65 | + asset_path: ./artifacts/SonarrAutoImport-win-x64.zip |
| 66 | + asset_name: SonarrAutoImport-win-x64.zip |
| 67 | + asset_content_type: application/zip |
| 68 | + |
| 69 | + - name: Upload SonarrAutoImport-linux-x64.zip |
| 70 | + if: ${{ github.event_name == 'push' }} |
| 71 | + uses: actions/upload-release-asset@v1.0.2 |
| 72 | + env: |
| 73 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + with: |
| 75 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 76 | + asset_path: ./artifacts/SonarrAutoImport-linux-x64.tar.gz |
| 77 | + asset_name: SonarrAutoImport-linux-x64.tar.gz |
| 78 | + asset_content_type: application/gzip |
| 79 | + |
| 80 | + - name: Upload SonarrAutoImport-osx-x64.zip |
| 81 | + if: ${{ github.event_name == 'push' }} |
| 82 | + uses: actions/upload-release-asset@v1.0.2 |
| 83 | + env: |
| 84 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + with: |
| 86 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 87 | + asset_path: ./artifacts/SonarrAutoImport-osx-x64.tar.gz |
| 88 | + asset_name: SonarrAutoImport-osx-x64.tar.gz |
| 89 | + asset_content_type: application/gzip |
0 commit comments