Skip to content

Refactor GitHub Actions workflow to remove obsolete BepInEx5 and BepI… #3

Refactor GitHub Actions workflow to remove obsolete BepInEx5 and BepI…

Refactor GitHub Actions workflow to remove obsolete BepInEx5 and BepI… #3

Workflow file for this run

name: Release

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

(Line: 3, Col: 8): Unexpected value '', (Line: 4, Col: 5): Unexpected value 'push', (Line: 7, Col: 5): Unexpected value 'workflow_dispatch'
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Need to fetch all for proper history
- name: Collect build info
id: info
uses: actions/github-script@v6
with:
script: |
let shortHash = "";
await exec.exec("git", ["rev-parse", "--short", "HEAD"], {
listeners: {
stdout: d => shortHash += d.toString().trim(),
}
});
core.setOutput("sha_short", shortHash);
// Get version from tag if available
let version = "";
if (context.ref.startsWith("refs/tags/")) {
version = context.ref.replace("refs/tags/", "");
if (version.startsWith("v")) {
version = version.substring(1);
}
}
core.setOutput("version", version);
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Build
run: |
dotnet build -c Release
dotnet pack -c Release --no-build -o ./bin/dist
- name: Publish to GitHub Packages
run: |
dotnet nuget push ./bin/dist/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://nuget-modding.resonite.net/v3/index.json --skip-duplicate
- name: Create GitHub Release
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: false
generate_release_notes: false
name: v${{ needs.build.outputs.version }}
tag_name: v${{ needs.build.outputs.version }}
target_commitish: ${{ github.sha }}
files: ./bin/dist/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}