Merge pull request #121 from Soup-um/main #53
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://acraven.medium.com/a-nuget-package-workflow-using-github-actions-7da8c6557863 | |
| name: Create new release from pushed tag | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, windows-latest, macos-latest ] | |
| name: Build, Test, and Upload Builds (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Set VERSION variable from tag | |
| if: ${{ contains(github.ref, 'refs/tags') }} | |
| shell: bash | |
| run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
| - name: Print VERSION variable for debugging | |
| shell: bash | |
| run: echo "$VERSION" | |
| - name: Publish for Linux x64 | |
| if: matrix.os == 'ubuntu-latest' | |
| run: dotnet publish -c Release -r linux-x64 --self-contained Refresher /p:Version=${VERSION} -o publish-x64/ | |
| - name: Publish for Linux ARM64 | |
| if: matrix.os == 'ubuntu-latest' | |
| run: dotnet publish -c Release -r linux-arm64 --self-contained Refresher /p:Version=${VERSION} -o publish-arm64/ | |
| - name: Publish for Windows x64 | |
| if: matrix.os == 'windows-latest' | |
| shell: bash | |
| run: dotnet publish -c Release -r win-x64 --no-self-contained Refresher //p:Version=${VERSION} -o publish/ | |
| - name: Publish for macOS x64 | |
| if: matrix.os == 'macos-latest' | |
| shell: bash | |
| run: dotnet publish -c Release -r osx-x64 --self-contained Refresher /p:Version=${VERSION} | |
| - name: Publish for macOS ARM64 | |
| if: matrix.os == 'macos-latest' | |
| shell: bash | |
| run: dotnet publish -c Release -r osx-arm64 --self-contained Refresher /p:Version=${VERSION} | |
| - name: Create macOS universal2 binary | |
| if: matrix.os == 'macos-latest' | |
| shell: bash | |
| working-directory: Refresher/bin/Release/net9.0/ | |
| run: | | |
| mkdir -p osx-universal2/publish/Refresher.app/Contents/MacOS | |
| cp -r osx-arm64/publish/*.app/Contents/ osx-universal2/publish/Refresher.app/Contents/ | |
| for file in $(find osx-arm64/publish/*.app/Contents/MacOS); do | |
| if [[ "$(file $file)" == *"Mach-O"* ]]; then | |
| if [[ "$(lipo -archs $file)" != *"x86_64 arm64"* ]]; then | |
| lipo -create osx-arm64/publish/*.app/Contents/MacOS/$(basename $file) osx-x64/publish/*.app/Contents/MacOS/$(basename $file) -output osx-universal2/publish/Refresher.app/Contents/MacOS/$(basename $file); | |
| fi; | |
| fi; | |
| done | |
| rm -rfv osx-universal2/publish/Refresher.app/Contents/MacOS/*.app | |
| codesign -fs - --deep osx-universal2/publish/Refresher.app | |
| - name: 'Tar macOS universal2 build' | |
| if: matrix.os == 'macos-latest' | |
| working-directory: Refresher/bin/Release/net9.0/osx-universal2/publish/ | |
| run: tar -czvf ../../../../../../Refresher_for_macOS.tar.gz *.app | |
| - name: Prepare Velopack | |
| if: matrix.os != 'macos-latest' | |
| run: | | |
| dotnet tool install -g vpk | |
| vpk download github --repoUrl https://github.com/${{ github.repository }} | |
| - name: Run vpk pack for Windows x64 | |
| if: matrix.os == 'windows-latest' | |
| shell: bash | |
| run: | | |
| vpk pack --channel windows-x64 --framework net9.0-x64-desktop --runtime win7-x64 --packId Refresher --packVersion $VERSION --packDir ./publish --mainExe Refresher.exe --packTitle Refresher --packAuthors LittleBigRefresh | |
| vpk upload github --channel windows-x64 --repoUrl https://github.com/${{ github.repository }} --merge --releaseName v$VERSION --tag v$VERSION --token ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run vpk pack for Linux x64 | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash | |
| run: | | |
| vpk pack --channel linux-x64 --runtime linux-x64 --packId Refresher --packVersion $VERSION --packDir ./publish-x64 --mainExe Refresher --packTitle Refresher --packAuthors LittleBigRefresh | |
| vpk upload github --channel linux-x64 --repoUrl https://github.com/${{ github.repository }} --merge --releaseName v$VERSION --tag v$VERSION --token ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run vpk pack for Linux ARM64 | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash | |
| run: | | |
| vpk pack --channel linux-arm64 --runtime linux-arm64 --packId Refresher --packVersion $VERSION --packDir ./publish-arm64 --mainExe Refresher --packTitle Refresher --packAuthors LittleBigRefresh | |
| vpk upload github --channel linux-arm64 --repoUrl https://github.com/${{ github.repository }} --merge --releaseName v$VERSION --tag v$VERSION --token ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload macOS universal2 build | |
| if: matrix.os == 'macos-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "Refresher_for_macOS" | |
| path: "Refresher_for_macOS.tar.gz" | |
| if-no-files-found: error | |
| retention-days: 1 | |
| release: | |
| name: Release Built Artifacts | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| id: download | |
| uses: actions/download-artifact@v4 | |
| - name: Create zip files | |
| run: | | |
| cd ${{steps.download.outputs.download-path}} | |
| mv ${{steps.download.outputs.download-path}}/Refresher_for_macOS/*.tar.gz . | |
| - uses: ncipollo/[email protected] | |
| name: "Create release" | |
| with: | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| prerelease: false | |
| draft: true | |
| generateReleaseNotes: true | |
| allowUpdates: true | |
| bodyFile: "RELEASE_NOTES.md" | |
| omitBody: 'false' | |
| omitBodyDuringUpdate: 'false' | |
| artifacts: | | |
| *.tar.gz |