Skip to content

Commit

Permalink
refactor: update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kalilistic committed Oct 23, 2021
1 parent 6bd75af commit caadc2e
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 1 deletion.
102 changes: 102 additions & 0 deletions .github/workflows/build-test.yml
@@ -0,0 +1,102 @@
name: [Testing] Build & deploy

on:
workflow_dispatch:
push:
branches:
- master

env:
PLUGIN_NAME: Kapture
PERSONAL_PLUGIN_REPO: kalilistic/DalamudPluginRepo

jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET for Build
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Restore dependencies
run: dotnet restore ./src
- name: Download Dalamud
run: |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev\"
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.7
- name: Build
run: |
dotnet build ./src --no-restore --configuration Release --nologo /property:Version=${{steps.gitversion.outputs.MajorMinorPatch}}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.1
with:
name: PluginRepoZip
path: ./src/${{env.PLUGIN_NAME}}/bin/Release/${{env.PLUGIN_NAME}}
if-no-files-found: error
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{steps.gitversion.outputs.FullSemVer}}
release_name: ${{env.PLUGIN_NAME}} ${{steps.gitversion.outputs.MajorMinorPatch}}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ./src/${{env.PLUGIN_NAME}}/bin/Release/${{env.PLUGIN_NAME}}/latest.zip
asset_name: ${{env.PLUGIN_NAME}}.zip
asset_content_type: application/zip

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
repository: ${{env.PERSONAL_PLUGIN_REPO}}
token: ${{secrets.PAT}}
- uses: actions/download-artifact@v2
with:
name: PluginRepoZip
path: plugins/${{env.PLUGIN_NAME}}
- uses: EndBug/add-and-commit@v7
with:
add: --all
author_name: GitHub Action
author_email: github-actions[bot]@users.noreply.github.com
message: Update ${{env.PLUGIN_NAME}}

pull_request:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
id: download-artifact
with:
name: PluginRepoZip
path: PluginArtifact
- uses: daemitus/DalamudPluginPR@v1
with:
enabled: true
testing: true
token: ${{secrets.PAT}}
artifact_path: ${{steps.download-artifact.outputs.download-path}}
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Expand Up @@ -94,8 +94,9 @@ jobs:
with:
name: PluginRepoZip
path: PluginArtifact
- uses: kalilistic/DalamudPluginPR@master
- uses: daemitus/DalamudPluginPR@v1
with:
enabled: true
testing: false
token: ${{secrets.PAT}}
artifact_path: ${{steps.download-artifact.outputs.download-path}}

0 comments on commit caadc2e

Please sign in to comment.