Skip to content

Commit

Permalink
refactor: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
kalilistic committed Sep 5, 2021
1 parent 7a4e758 commit 0e37ac4
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 185 deletions.
151 changes: 88 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,101 @@
name: Build plugin
name: Build & deploy

on:
workflow_dispatch:
push:
branches:
- master

env:
PLUGIN_NAME: SillyChat
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/stg/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev\"
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]

- name: Build
run: |
dotnet build ./src --no-restore --configuration Release --nologo /property:Version=${{steps.gitversion.outputs.MajorMinorPatch}}
- name: Run xUnit Tests
run: |
dotnet test ./src/${{env.PLUGIN_NAME}}.Test/${{env.PLUGIN_NAME}}.Test.csproj
- 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/stg/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev\"
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Build
run: |
dotnet build ./src --no-restore --configuration Release --nologo /property:Version=${{steps.gitversion.outputs.MajorMinorPatch}}
- name: Upload a Build Artifact
uses: actions/[email protected]
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

- name: Upload a Build Artifact
uses: actions/[email protected]
with:
path: |
./src/${{env.PLUGIN_NAME}}/bin/Release/out/${{env.PLUGIN_NAME}}/*
- 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/out/${{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: kalilistic/DalamudPluginPR@master
with:
enabled: true
token: ${{secrets.PAT}}
artifact_path: ${{steps.download-artifact.outputs.download-path}}
61 changes: 0 additions & 61 deletions .github/workflows/plugins.yml

This file was deleted.

61 changes: 0 additions & 61 deletions .github/workflows/testing.yml

This file was deleted.

1 change: 1 addition & 0 deletions src/SillyChat.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ Global
{EBAF1BDC-2509-4504-8A4B-ED9C563FBEB6}.Release|Any CPU.Build.0 = Release|x64
{F69B7274-8325-41F4-AAE2-D5F99777878F}.Debug|Any CPU.ActiveCfg = Debug|x64
{F69B7274-8325-41F4-AAE2-D5F99777878F}.Release|Any CPU.ActiveCfg = Release|x64
{F69B7274-8325-41F4-AAE2-D5F99777878F}.Debug|Any CPU.Build.0 = Debug|x64
EndGlobalSection
EndGlobal

0 comments on commit 0e37ac4

Please sign in to comment.