forked from PoryGoneDev/Celeste64
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request EXOK#90 from FujiAPI/workflow-improvements
Reworking Github Actions Build And Publish Workflow
- Loading branch information
Showing
5 changed files
with
149 additions
and
247 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,138 @@ | ||
name: Build and publish branch | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
required: true | ||
description: Tag for the release that is generated. This must use semvar like `X.Y.Z` for stable branches or `beta-X.Y.Z-*` for beta branches | ||
is-beta: | ||
type: boolean | ||
default: false | ||
description: Is this a beta release? | ||
make-latest: | ||
type: boolean | ||
default: true | ||
description: Should the generated release be flagged as the latest release? | ||
prerelease: | ||
type: boolean | ||
default: false | ||
description: Should the generated release be flagged as a prerelease? | ||
draft: | ||
type: boolean | ||
default: true | ||
description: Should the generated release be flagged as a draft? | ||
|
||
permissions: | ||
contents: write | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
validate_inputs: | ||
name: Validate Inputs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Validate Stable Tag | ||
if: ${{ ! inputs.is-beta }} | ||
run: | | ||
if [[ !(${{ inputs.tag }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$) ]]; then | ||
echo "Error: Tag is not in a valid semvar format. Stable releases should follow the format of 'X.Y.Z'" | ||
exit 1 | ||
fi | ||
- name: Validate Beta Tag | ||
if: ${{ inputs.is-beta }} | ||
run: | | ||
if [[ !(${{ inputs.tag }} =~ ^beta\-[0-9]+\.[0-9]+\.[0-9]+\-*) ]]; then | ||
echo "Error: Tag is formatted correctly. Beta releases should follow the format of 'beta-X.Y.Z-*'" | ||
exit 1 | ||
fi | ||
create_release: | ||
name: Create Release | ||
needs: validate_inputs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-tags: true | ||
|
||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ inputs.tag }} | ||
commit: "${{ github.sha }}" | ||
body: | | ||
# Instructions: | ||
- Download and extract the zip file below according to your computer | ||
- Run the Celeste64-Fuji application from the extracted files | ||
# Requirements: | ||
- **Windows:** 10 or later, x64 | ||
- **Linux:** [Distro support list](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md), x64 or arm | ||
- **macOS:** Monterey or later, x64 or arm Intel-based or Apple Silicon with Rosetta | ||
allowUpdates: true | ||
name: "Fuji ${{ inputs.tag }} " | ||
prerelease: ${{ inputs.prerelease }} | ||
makeLatest: ${{ inputs.make-latest }} | ||
draft: ${{ inputs.draft }} | ||
|
||
build: | ||
name: Build Artifacts | ||
needs: create_release | ||
strategy: | ||
matrix: | ||
include: | ||
- { platform: macos-latest, rid: osx-arm64 } | ||
- { platform: macos-latest, rid: osx-x64 } | ||
- { platform: ubuntu-latest, rid: linux-arm } | ||
- { platform: ubuntu-latest, rid: linux-arm64 } | ||
- { platform: ubuntu-latest, rid: linux-x64 } | ||
- { platform: windows-latest, rid: win-x64 } | ||
|
||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-tags: true | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Build | ||
run: | | ||
dotnet publish Celeste64.Launcher/Celeste64.Launcher.csproj -c Release -r ${{ matrix.rid }} -p:ImportByWildcardBeforeSolution=false "-p:EmbeddedBuildProperty=BuildVersion=${{ inputs.tag }}" -o build | ||
cp -r Content Mods build | ||
- name: Compress | ||
if: runner.os == 'Windows' | ||
shell: pwsh | ||
run: | | ||
cd build && Compress-Archive * ../Celeste64-Fuji-${{ matrix.rid }}-${{ inputs.tag }}.zip | ||
- name: Compress | ||
if: runner.os != 'Windows' | ||
run: | | ||
cd build && zip -r ../Celeste64-Fuji-${{ matrix.rid }}-${{ inputs.tag }}.zip * | ||
- name: Upload artifact to release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: Celeste64-Fuji-${{ matrix.rid }}-${{ inputs.tag }}.zip | ||
commit: "${{ github.sha }}" | ||
tag: ${{ inputs.tag }} | ||
allowUpdates: true | ||
omitNameDuringUpdate: true | ||
omitBodyDuringUpdate: true | ||
draft: ${{ inputs.draft }} | ||
|
||
- name: Cancel release | ||
if: ${{ failure() }} | ||
run: gh release delete --cleanup-tag -y ${{ inputs.tag }} | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.