forked from MKhayle/XIVComboExpanded
-
Notifications
You must be signed in to change notification settings - Fork 10
120 lines (115 loc) · 3.77 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Build
# Put your personal access token in a repository secret named PAT for cross-repository access
permissions:
contents: write
on:
workflow_dispatch:
push:
paths-ignore:
- '*.md'
branches:
- master
- main
- release
pull_request:
paths-ignore:
- '*.md'
branches:
- master
- main
- release
env:
INTERNAL_NAME: XIVComboVX
CONFIGURATION: Release
PERSONAL_PLUGIN_REPO: PrincessRTFM/MyDalamudPlugins
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
jobs:
precheck:
runs-on: ubuntu-latest
outputs:
buildVersion: ${{ steps.data.outputs.buildVersion }}
tagName: ${{ steps.data.outputs.tagName }}
tagExists: ${{ steps.check-version-tag.outputs.tagExists }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Load values
id: data
run: |
buildVersion=$(grep -Ei '<version>[^<]+</version>' "${{ env.INTERNAL_NAME }}/${{ env.INTERNAL_NAME }}.csproj" | sed -e 's/.\+<version>\([^<]\+\)<.\+/\1/i' -)
echo "buildVersion=$buildVersion" >> "$GITHUB_OUTPUT"
echo "tagName=v$buildVersion" >> "$GITHUB_OUTPUT"
shell: bash
- name: Check if version exists
id: check-version-tag
run: |
if git show-ref --quiet --tags "${{ steps.data.outputs.tagName }}"; then echo "tagExists=true" >> "$GITHUB_OUTPUT"; else echo "tagExists=false" >> "$GITHUB_OUTPUT"; fi
shell: bash
- name: Debug
run: |
echo "Current version is ${{ steps.data.outputs.buildVersion }} for tag ${{ steps.data.outputs.tagName }} (exists = ${{ steps.check-version-tag.outputs.tagExists }})"
shell: bash
build:
needs: precheck
if: needs.precheck.outputs.tagExists == 'false'
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup MSBuild
uses: microsoft/[email protected]
- 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: Restore
run: dotnet restore -r win
- name: Build
run: dotnet build -c ${{ env.CONFIGURATION }} --no-restore
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: PluginRepoZip
path: ${{ env.INTERNAL_NAME }}/bin/${{ env.CONFIGURATION }}/${{ env.INTERNAL_NAME }}
if-no-files-found: error
retention-days: 14
- name: Tag
run: |
git tag -am "[Automated build $BUILD_VERSION]" "$TAG_NAME"
git push origin "$TAG_NAME"
shell: bash
env:
BUILD_VERSION: ${{ needs.precheck.outputs.buildVersion }}
TAG_NAME: ${{ needs.precheck.outputs.tagName }}
GIT_AUTHOR_NAME: GitHub Action
GIT_COMMITTER_NAME: GitHub Action
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: master
repository: ${{ env.PERSONAL_PLUGIN_REPO }}
token: ${{ secrets.PAT }}
- name: Download build
uses: actions/download-artifact@v3
with:
name: PluginRepoZip
path: plugins/${{ env.INTERNAL_NAME }}
- name: Commit
uses: EndBug/add-and-commit@v9
with:
add: plugins/
pathspec_error_handling: exitImmediately
author_name: GitHub Action
author_email: github-actions[bot]@users.noreply.github.com
message: Update ${{ env.INTERNAL_NAME }}