-
Notifications
You must be signed in to change notification settings - Fork 224
144 lines (128 loc) · 4.6 KB
/
push.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Deployment
on: [push, workflow_dispatch]
concurrency:
group: plogon-deploy
cancel-in-progress: true
jobs:
run-plogon:
name: Build Plugins
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Get Pull Request data
uses: actions/github-script@v7
id: get_pr_data
with:
script: |
const pr = (
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[0];
const reviews = (
await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
})
).data;
// Filter reviews for approved ones
const approvedReviews = reviews.filter(review => review.state === 'APPROVED');
if (approvedReviews.length === 0) {
throw new Error("Pull request has no approved reviews.");
}
// Setting the output explicitly
return {
number: pr.number,
title: pr.title,
first_approved_reviewer: approvedReviews[0].user.login
};
outputs: result
- name: Checkout manifests
uses: actions/checkout@v3
with:
repository: goatcorp/DalamudPluginsD17
path: manifests
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Difftastic
run: |
wget https://github.com/Wilfred/difftastic/releases/latest/download/difft-x86_64-unknown-linux-gnu.tar.gz
tar -xzf difft-x86_64-unknown-linux-gnu.tar.gz
sudo mv difft /usr/local/bin/difft
sudo chmod +x /usr/local/bin/difft
difft --version
- name: Checkout Plogon
uses: actions/checkout@v3
with:
repository: goatcorp/Plogon
#ref: V1.0.6
path: Plogon
- name: Checkout Dist
uses: actions/checkout@v3
with:
repository: goatcorp/PluginDistD17
path: output
ssh-key: ${{ secrets.DIST_SSH_KEY }}
persist-credentials: true
ref: main
- name: Create required folders
run: |
mkdir artifacts
mkdir work
- name: Cache docker image
uses: actions/cache@v3
env:
cache-name: ${{ secrets.EXTENDED_IMAGE_LINK }}
with:
path: ~/.plogon_cache
key: cache-${{ env.cache-name }}
- name: Run Plogon
working-directory: Plogon/Plogon
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PAC_DISCORD_WEBHOOK: ${{ secrets.PAC_DISCORD_WEBHOOK }}
EXTENDED_IMAGE_LINK: ${{ secrets.EXTENDED_IMAGE_LINK }}
PLOGON_SECRETS_PK: ${{ secrets.PLOGON_SECRETS_PK }}
PLOGON_SECRETS_PK_PASSWORD: ${{ secrets.PLOGON_SECRETS_PK_PASSWORD }}
PLOGON_ACTOR: ${{ fromJson(steps.get_pr_data.outputs.result).first_approved_reviewer }}
XLWEB_KEY: ${{ secrets.XLWEB_KEY }}
PLOGON_S3_ACCESSKEY: ${{ secrets.PLOGON_S3_ACCESSKEY }}
PLOGON_S3_SECRET: ${{ secrets.PLOGON_S3_SECRET }}
PLOGON_S3_REGION: ${{ secrets.PLOGON_S3_REGION }}
run: |
dotnet run -- \
--manifest-folder="${{ github.workspace }}/manifests" \
--output-folder="${{ github.workspace }}/output" \
--work-folder="${{ github.workspace }}/work" \
--static-folder="${{ github.workspace }}/Plogon/Plogon/static" \
--artifact-folder="${{ github.workspace }}/artifacts" \
--build-overrides-file="${{ github.workspace }}/manifests/overrides.toml" \
--ci --mode=Commit --build-all
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: plugin-artifact
path: artifacts
- name: Commit files
continue-on-error: true
run: |
cd ${{ github.workspace }}/output
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update distribute (${{ github.sha }})"
- name: Push plugin dist
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: output
repository: goatcorp/PluginDistD17
ssh: true
- name: Signal XLWeb commit
run: |
curl --request POST \
--url https://kamori.goats.dev/Plogon/CommitStagedPlugins \
--header 'X-XL-Key: ${{ secrets.XLWEB_KEY }}'