fixing everything i guess it works idk #45
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: .NET Core Desktop | |
| permissions: | |
| contents: write | |
| issues: write | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| configuration: [ Release ] | |
| runs-on: windows-latest # i guess i need windows | |
| env: | |
| Solution_Name: VirtualMicApp.sln | |
| Project_Path: VirtualMicApp/VirtualMicApp.csproj | |
| Output_Directory: VirtualMicApp/bin/${{ matrix.configuration }}/publish | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET Core | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Build the project | |
| run: dotnet build ${{ env.Project_Path }} --configuration ${{ matrix.configuration }} | |
| - name: Publish the project (produce .exe) | |
| run: dotnet publish ${{ env.Project_Path }} --configuration ${{ matrix.configuration }} --output ${{ env.Output_Directory }} --self-contained --runtime win-x64 | |
| - name: Zip everything built using PowerShell | |
| run: | | |
| Compress-Archive -Path ${{ env.Output_Directory }}\* -DestinationPath VirtualMicApp.zip | |
| - name: Upload Zip as Artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: BO | |
| path: VirtualMicApp.zip | |
| recreate_release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Delete Existing Release | |
| id: delete_release | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const tag = "v1"; | |
| // List all releases and find the release by tag | |
| const releases = await github.rest.repos.listReleases({ | |
| owner: owner, | |
| repo: repo, | |
| }); | |
| const release = releases.data.find(release => release.tag_name === tag); | |
| // Check if the release exists and delete it | |
| if (release) { | |
| await github.rest.repos.deleteRelease({ | |
| owner: owner, | |
| repo: repo, | |
| release_id: release.id, | |
| }); | |
| console.log(`Deleted release with ID ${release.id}`); | |
| } else { | |
| console.log("No existing release to delete"); | |
| } | |
| // Delete the tag | |
| try { | |
| await github.rest.git.deleteRef({ | |
| owner: owner, | |
| repo: repo, | |
| ref: `tags/${tag}`, | |
| }); | |
| console.log(`Deleted tag ${tag}`); | |
| } catch (error) { | |
| console.error(`Error deleting tag: ${error.message}`); | |
| } | |
| - name: Download Artifact | |
| uses: actions/download-artifact@v3 | |
| with: | |
| name: BO | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: v1 | |
| tag_name: v1 | |
| body: | | |
| **This release has been built by Github Actions** | |
| [Link to build](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| yeahhh :D | |
| files: | | |
| VirtualMicApp.zip |