Revert last commit #31
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
| name: Build and Publish | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| tags: | |
| - '*' | |
| paths: | |
| - '**' | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| contents: write | |
| jobs: | |
| build_and_release: | |
| runs-on: 'windows-latest' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Publish | |
| shell: pwsh | |
| run: | | |
| dotnet publish PS4Saves.csproj --configuration Release --output ./publish/win-x64 | |
| cd ./publish/win-x64 | |
| Compress-Archive -Path ./* -DestinationPath save-mounter.zip | |
| - name: Attest | |
| uses: actions/attest-build-provenance@v1 | |
| with: | |
| subject-path: ./publish/win-x64/save-mounter.zip | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: save-mounter.zip | |
| path: ./publish/win-x64/save-mounter.zip | |
| - name: Create or Update GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| RELEASE_EXISTS=$(gh release view $TAG_NAME > /dev/null 2>&1; echo $?) | |
| if [ $RELEASE_EXISTS -eq 0 ]; then | |
| echo "Release $TAG_NAME already exists. Uploading assets..." | |
| gh release upload $TAG_NAME ./publish/win-x64/save-mounter.zip | |
| else | |
| echo "Creating new release $TAG_NAME..." | |
| gh release create $TAG_NAME --verify-tag -d ./publish/win-x64/save-mounter.zip | |
| fi |