Skip to content

Commit

Permalink
Upload workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
chirpxiv committed Sep 28, 2024
1 parent ed0db5c commit c6c4d80
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: chirpxiv
ko_fi: chirpxiv
2 changes: 2 additions & 0 deletions .github/release-notices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**Don't install GoodOmen by downloading this manually!**
See the README for instructions on plugin installation.
97 changes: 97 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Thanks to @Blooym and @Fayti1703

name: Release

# Add a concurrency group incase a tag is created, deleted, and then recreated while a release is in progress.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Only run this workflow when a tag is pushed when the tag starts with "v".
on:
push:
tags:
- 'v*'

# So we can use the GitHub API to create releases with the run token.
permissions:
contents: write

jobs:
Release:
if: github.event.pull_request.draft == false # Ignore draft PRs
runs-on: ubuntu-latest
defaults:
run:
working-directory: Pathfinder/
shell: bash
env:
DALAMUD_HOME: /tmp/dalamud
IsCI: true
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true # Grab any submodules that may be required

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

- name: Download Dalamud Library
run: |
wget https://goatcorp.github.io/dalamud-distrib/latest.zip -O /tmp/dalamud.zip
unzip /tmp/dalamud.zip -d /tmp/dalamud
- name: Restore Dependencies
run: dotnet restore

- name: Build plugin in release mode
run: dotnet build -c Release --no-restore --nologo -o ./bin/Release

- name: Generate Checksums
working-directory: Pathfinder/bin/Release/Pathfinder
run: |
sha512sum latest.zip >> checksums.sha512
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
Pathfinder/bin/Release/Pathfinder/latest.zip
Pathfinder/bin/Release/Pathfinder/checksums.sha512
prerelease: false # Releases cant be marked as prereleases as Dalamud wont be able to find them
append_body: true # Append the release notes to the release body
body_path: .github/release-notices.md # These notes are automatically added to the release body every time.
generate_release_notes: true # Automatically makes a release body from PRs since the last release.
fail_on_unmatched_files: true # If the files arent found, fail the workflow and abort the release.

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Release Artifacts
path: |
Pathfinder/bin/Release/Pathfinder/latest.zip
Pathfinder/bin/Release/Pathfinder/checksums.sha512
- name: Update repo.json
run: |
cd ../
release_version=$(echo ${{ github.ref_name }} | sed 's/^v//')
repo_url=$(echo ${{ github.server_url }}/${{ github.repository }} | sed 's/#/\\#/g')
sed -i repo.json -E \
-e 's#"AssemblyVersion": "([0-9]*\.){2,3}[0-9]*"#"AssemblyVersion": "'"$release_version"'"#g' \
-e 's#"TestingAssemblyVersion": "([0-9]*\.){2,3}[0-9]*"#"TestingAssemblyVersion": "'"$release_version"'"#' \
-e 's#"DownloadLinkInstall": "[^"]*"#"DownloadLinkInstall": "'"$repo_url/releases/download/${{ github.ref_name }}/latest.zip"'"#g' \
-e 's#"DownloadLinkTesting": "[^"]*"#"DownloadLinkTesting": "'"$repo_url/releases/download/${{ github.ref_name }}/latest.zip"'"#g' \
-e 's#"DownloadLinkUpdate": "[^"]*"#"DownloadLinkUpdate": "'"$repo_url/releases/download/${{ github.ref_name }}/latest.zip"'"#g'
git add repo.json
git config --local user.name "github-actions [bot]"
git config --local user.email "[email protected]"
git commit -m "Update repo.json for ${{ github.ref_name }}"
git push origin HEAD:main
64 changes: 64 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Thanks to @Blooym and @Fayti1703

name: Tests

# If another commit is made to the same pull request, the previous workflow run is cancelled to save resources.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

# Only run CI against the main branch or on PRs to the main branch.
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [ready_for_review, opened, synchronize]
workflow_dispatch:

jobs:
Build:
if: github.event.pull_request.draft == false # Ignore draft PRs
runs-on: ubuntu-latest
defaults:
run:
working-directory: Pathfinder/
shell: bash
strategy:
matrix:
dotnet-version: [7.0.x] # Can add multiple .NET versions here to test against (For example, testing a new version of .NET before it's released)
dalamud-version: ["latest"] # Can add multiple Dalamud branches here to test against (For example, testing against Dalamud staging)
env:
DALAMUD_HOME: /tmp/dalamud
IsCI: true
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # We don't need the history for testing builds, so we can save some time by not fetching it
submodules: true # Grab any submodules that may be required

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Download Dalamud Library
run: |
wget https://goatcorp.github.io/dalamud-distrib/${{ matrix.dalamud-version }}.zip -O /tmp/dalamud.zip
unzip /tmp/dalamud.zip -d /tmp/dalamud
- name: Restore Dependencies
run: dotnet restore

- name: Build plugin in debug mode
run: dotnet build -c Debug --no-restore --nologo

- name: Build plugin in release mode
run: dotnet build -c Release --no-restore --nologo

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Build Artifacts
path: Pathfinder/bin/

0 comments on commit c6c4d80

Please sign in to comment.