|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + tags: |
| 7 | + - "v*" |
| 8 | + branches-ignore: |
| 9 | + - gh-pages |
| 10 | + pull_request: |
| 11 | + branches: [ "main" ] |
| 12 | + branches-ignore: |
| 13 | + - gh-pages |
| 14 | + |
| 15 | +jobs: |
| 16 | + build_nonpackaged: |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + configuration: [Debug, Release] |
| 20 | + platform: [x64] |
| 21 | + runs-on: windows-latest |
| 22 | + |
| 23 | + env: |
| 24 | + ZIP_FILE: MicaForEveryone-${{ matrix.platform }}-${{ matrix.configuration }}.zip |
| 25 | + INSTALLER_FILE_BASE_NAME: MicaForEveryone-${{ matrix.platform }}-${{ matrix.configuration }}-Installer |
| 26 | + RELEASE_DIR: Release |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + - name: Get Version |
| 34 | + id: get_version |
| 35 | + uses: MicaForEveryone/get-version-action@v2.3.1 |
| 36 | + if: startsWith(github.ref, 'refs/tags/v') |
| 37 | + - name: Add msbuild to PATH |
| 38 | + uses: microsoft/setup-msbuild@v1.3 |
| 39 | + |
| 40 | + # Zip |
| 41 | + - name: Build the application |
| 42 | + run: msbuild MicaForEveryone\MicaForEveryone.csproj /restore /p:BuildingInCI=true /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} /p:ReleaseDirectory=..\${{ env.RELEASE_DIR }} /p:ZipName=${{ env.ZIP_FILE }} /t:ReleaseZip |
| 43 | + - name: Upload ZIP artifact |
| 44 | + uses: actions/upload-artifact@v3 |
| 45 | + with: |
| 46 | + name: ${{ env.ZIP_FILE }} |
| 47 | + path: ${{ env.RELEASE_DIR }}\${{ env.ZIP_FILE }} |
| 48 | + if-no-files-found: error |
| 49 | + |
| 50 | + # Installer |
| 51 | + - name: Build Installer |
| 52 | + run: iscc Installer.iss /O${{ env.RELEASE_DIR }} |
| 53 | + env: |
| 54 | + Source: MicaForEveryone\bin\${{ matrix.platform }}\${{ matrix.configuration }}\netcoreapp3.1 |
| 55 | + VERSION: ${{ startsWith(github.ref, 'refs/tags/v') && steps.get_version.outputs.version-without-v || '0.0.0.0' }} # Use version tag if available, else use 0.0.0.0 |
| 56 | + - name: Upload installer artifact |
| 57 | + uses: actions/upload-artifact@v3 |
| 58 | + with: |
| 59 | + name: ${{ env.INSTALLER_FILE_BASE_NAME }} |
| 60 | + path: ${{ env.RELEASE_DIR }}\${{ env.INSTALLER_FILE_BASE_NAME }}.exe |
| 61 | + if-no-files-found: error |
| 62 | + |
| 63 | + build_packaged: |
| 64 | + strategy: |
| 65 | + matrix: |
| 66 | + configuration: [Debug, Release] |
| 67 | + platform: [x64] |
| 68 | + runs-on: windows-latest |
| 69 | + |
| 70 | + env: |
| 71 | + MSIX_FILE: MicaForEveryone-${{ matrix.platform }}-${{ matrix.configuration }}.msix |
| 72 | + RELEASE_DIR: Release |
| 73 | + |
| 74 | + steps: |
| 75 | + - name: Checkout |
| 76 | + uses: actions/checkout@v4 |
| 77 | + with: |
| 78 | + fetch-depth: 0 |
| 79 | + - name: Get Version |
| 80 | + id: get_version |
| 81 | + uses: MicaForEveryone/get-version-action@v2.3.1 |
| 82 | + if: startsWith(github.ref, 'refs/tags/v') |
| 83 | + - name: Add msbuild to PATH |
| 84 | + uses: microsoft/setup-msbuild@v1.3 |
| 85 | + |
| 86 | + - name: Package MSIX |
| 87 | + run: msbuild MicaForEveryone.Package\MicaForEveryone.Package.wapproj /restore /p:BuildingInCI=true /p:Configuration=${{ matrix.configuration }} /p:AppxBundle=Never /p:Platform=${{ matrix.platform }} /p:ErrorOnDuplicatePublishOutputFiles=false /p:ReleaseDirectory=..\${{ env.RELEASE_DIR }} /p:MsixName=${{ env.MSIX_FILE }} /t:ReleaseMsix |
| 88 | + - name: Sign Package |
| 89 | + env: |
| 90 | + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} |
| 91 | + if: "${{ env.KEY_PASSWORD != '' }}" |
| 92 | + run: '& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64\signtool.exe" sign /fd SHA256 /a /f MicaForEveryone.pfx /p "${{ secrets.KEY_PASSWORD }}" ${{ env.RELEASE_DIR }}\${{ env.MSIX_FILE }}' |
| 93 | + - name: Upload MSIX |
| 94 | + uses: actions/upload-artifact@v3 |
| 95 | + with: |
| 96 | + name: ${{ env.MSIX_FILE }} |
| 97 | + path: ${{ env.RELEASE_DIR }}\${{ env.MSIX_FILE }} |
| 98 | + if-no-files-found: error |
| 99 | + |
| 100 | + release: |
| 101 | + needs: [build_nonpackaged, build_packaged] |
| 102 | + runs-on: ubuntu-latest |
| 103 | + if: startsWith(github.ref, 'refs/tags/v') |
| 104 | + |
| 105 | + steps: |
| 106 | + - uses: actions/download-artifact@v3 |
| 107 | + with: |
| 108 | + path: artifacts |
| 109 | + - name: Release |
| 110 | + uses: softprops/action-gh-release@v1 |
| 111 | + with: |
| 112 | + draft: true |
| 113 | + files: artifacts/**/* |
| 114 | + |
| 115 | + winget: |
| 116 | + needs: [release] |
| 117 | + runs-on: ubuntu-latest |
| 118 | + steps: |
| 119 | + - uses: vedantmgoyal2009/winget-releaser@v2 |
| 120 | + with: |
| 121 | + identifier: MicaForEveryone.MicaForEveryone |
| 122 | + installers-regex: 'MicaForEveryone-\w+-Release-Installer\.exe$' |
| 123 | + token: ${{ secrets.WINGET_TOKEN }} |
0 commit comments