forked from SteamRE/DepotDownloader
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4644cd
commit 762c3b1
Showing
1 changed file
with
124 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Nightly Build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_nightly: | ||
runs-on: windows-latest | ||
name: Build Nightly | ||
outputs: | ||
full_sha: ${{ steps.var.outputs.full_sha }} | ||
short_sha: ${{ steps.var.outputs.short_sha }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Build 64bit release DLL | ||
shell: bash | ||
run: | | ||
dotnet build --configuration Release /p:PackageOutputPath=./ReleaseOutput /p:OutputPath=./ReleaseOutput | ||
cp ./RoR2VersionSelector/ReleaseOutput/RoR2VersionSelector.exe ./DepotDownloader/ReleaseOutput/RoR2VersionSelector.exe | ||
mv ./DepotDownloader/ReleaseOutput/ ./build | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: binary | ||
path: | | ||
build/* | ||
- name: Generate Build Info | ||
id: var | ||
run: | | ||
echo "full_sha=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT | ||
echo "short_sha=$(git rev-parse --short HEAD)" >> $env:GITHUB_OUTPUT | ||
create_release: | ||
runs-on: ubuntu-latest | ||
name: Create Release | ||
needs: build_nightly | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- 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 = "nightly"; | ||
// 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: binary | ||
|
||
- name: Echo build sha256 | ||
id: build_sha | ||
run: | | ||
sha256sum release.zip > sha256.checksum | ||
echo "build_sha=$(cat sha256.checksum)" >> $GITHUB_OUTPUT | ||
cat sha256.checksum | ||
- name: Nightly Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Nightly [${{ needs.build_nightly.outputs.short_sha }}] | ||
tag_name: nightly | ||
body: | | ||
**This release has been built by Github Actions** | ||
[Link to build](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | ||
Build SHA256: | ||
``` | ||
${{ steps.build_sha.outputs.build_sha }} | ||
``` | ||
To verify the build SHA256 during the action, click the build link, go-to "Create Release", open the Echo build sha256 step and read the sha256. | ||
You can download the build artifacts, generate a SHA256 checksum and compare it with the below binary. | ||
Build artifacts ARE NOT automatically the same as release assets since release assets can be modified afterwards. | ||
Full Commit Hash: | ||
``` | ||
${{ needs.build_nightly.outputs.full_sha }} | ||
``` | ||
files: | | ||
release.zip |