More tweaking release logic #8
This file contains 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 Release | ||
on: push | ||
# push: | ||
# branches: [ "main", "master" ] | ||
jobs: | ||
call_check_version: | ||
uses: ./.github/workflows/check_version.yml | ||
build_and_release: | ||
runs-on: windows-latest | ||
needs: call_check_version | ||
if: always() && (needs.call_check_version.result == 'success') | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: | | ||
5.0.x | ||
6.0.x | ||
7.0.x | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
## Might as well build and test since we're here | ||
- name: Build | ||
run: dotnet build --no-restore | ||
- name: Test | ||
run: dotnet test --no-build --verbosity normal | ||
## This lets us build the electron app | ||
- name: Install ElectronNET.CLI | ||
run: dotnet tool install ElectronNET.CLI -g | ||
- name: Build Release Artifact | ||
run: | | ||
Check failure on line 43 in .github/workflows/build_and_release.yml GitHub Actions / Build and ReleaseInvalid workflow file
|
||
cd GUI | ||
electronize build /target win | ||
echo "releaseArtifactPath='D:\a\deep-rock-galactic-save-syncer\deep-rock-galactic-save-syncer\GUI\bin\Desktop\DRG Save Syncer Setup ${{ jobs.check_version.outputs.version }}.exe"' >> "$GITHUB_OUTPUT" | ||
- name: Create Draft Release | ||
id: create_release | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const { data: release } = await github.rest.repos.createRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag_name: 'v${{ jobs.check_version.outputs.version }}', | ||
name: 'Deep Rock Galactic Save Syncer v${{ jobs.check_version.outputs.version }}', | ||
draft: true, | ||
generate_release_notes: true | ||
}); | ||
echo "releaseId=${release.id}" >> "$GITHUB_OUTPUT" | ||
- name: Upload Release Artifact | ||
id: upload_release_artifact | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const { data: releaseAsset } = await github.rest.repos.uploadReleaseAsset({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: ${{ steps.create_release.outputs.releaseId }}, | ||
name: 'DeepRockGalacticSaveSyncer-v${{ jobs.check_version.outputs.version }}.exe', | ||
data: fs.readFileSync(${{ steps.create_release.outputs.releaseArtifactPath }}) | ||
}); |