-
Notifications
You must be signed in to change notification settings - Fork 18
180 lines (150 loc) · 6.19 KB
/
release-daily.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Build & Publish Dev Release
on:
push:
branches:
- dev
jobs:
current_info:
runs-on: ubuntu-latest
name: Current Information
outputs:
version: ${{ steps.release_info.outputs.version }}
tag: ${{ steps.release_info.outputs.tag }}
date: ${{ steps.commit_date_iso8601.outputs.date }}
sha: ${{ github.sha }}
sha_short: ${{ steps.commit_info.outputs.sha }}
changelog: ${{ steps.generate_changelog.outputs.CHANGELOG }}
steps:
- name: Checkout master
uses: actions/checkout@master
with:
ref: "${{ github.ref }}"
fetch-depth: 0 # This is set to download the full git history for the repo
- name: Get Previous Version
id: previous_release_info
uses: revam/gh-action-get-tag-and-version@v1
with:
branch: false
prefix: "v"
prefixRegex: "[vV]?"
suffixRegex: "dev"
suffix: "dev"
- name: Get Current Version
id: release_info
uses: revam/gh-action-get-tag-and-version@v1
with:
branch: false
increment: suffix
prefix: "v"
prefixRegex: "[vV]?"
suffixRegex: "dev"
suffix: "dev"
- name: Get Commit Date (as ISO8601)
id: commit_date_iso8601
shell: bash
run: |
echo "date=$(git --no-pager show -s --format=%aI ${{ github.sha }})" >> "$GITHUB_OUTPUT"
- id: commit_info
name: Shorten Commit Hash
uses: actions/github-script@v6
with:
script: |
const sha = context.sha.substring(0, 7);
core.setOutput("sha", sha);
- name: Generate Changelog
id: generate_changelog
env:
PREVIOUS_COMMIT: ${{ steps.previous_release_info.outputs.commit }}
NEXT_COMMIT: ${{ github.sha }}
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "CHANGELOG<<$EOF" >> "$GITHUB_OUTPUT"
node .github/workflows/git-log-json.mjs $PREVIOUS_COMMIT..$NEXT_COMMIT | jq -r '.[] | "\n`\(.type)`: **\(.subject)**" + if .body != null and .body != "" then if .isSkipCI then ": (_Skip CI_)\n\n\(.body)" else ":\n\n\(.body)" end else if .isSkipCI then ". (_Skip CI_)" else "." end end' >> "$GITHUB_OUTPUT"
echo -e "\n$EOF" >> "$GITHUB_OUTPUT"
build_plugin:
runs-on: ubuntu-latest
needs:
- current_info
name: Build & Release (Dev)
steps:
- name: Checkout
uses: actions/checkout@master
with:
ref: ${{ github.ref }}
fetch-depth: 0 # This is set to download the full git history for the repo
- name: Fetch Dev Manifest from Metadata Branch
run: |
git checkout origin/metadata -- dev/manifest.json;
git reset;
rm manifest.json;
mv dev/manifest.json manifest.json;
rmdir dev;
- name: Setup .Net
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Restore Nuget Packages
run: dotnet restore Shokofin/Shokofin.csproj
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install JPRM
run: python -m pip install jprm
- name: Run JPRM
env:
CHANGELOG: ${{ needs.current_info.outputs.changelog }}
run: python build_plugin.py --repo ${{ github.repository }} --version=${{ needs.current_info.outputs.version }} --tag=${{ needs.current_info.outputs.tag }} --prerelease=True
- name: Change to Metadata Branch
run: |
mkdir dev;
mv manifest.json dev
git add ./dev/manifest.json;
git stash push --staged --message "Temp release details";
git reset --hard;
git checkout origin/metadata -B metadata;
git stash apply || git checkout --theirs dev/manifest.json;
git reset;
- name: Create Pre-Release
uses: softprops/action-gh-release@v1
with:
files: ./artifacts/shoko_*.zip
name: "Shokofin Dev ${{ needs.current_info.outputs.version }}"
tag_name: ${{ needs.current_info.outputs.tag }}
body: |
Update your plugin using the [dev manifest](https://raw.githubusercontent.com/ShokoAnime/Shokofin/metadata/dev/manifest.json) or by downloading the release from [GitHub Releases](https://github.com/ShokoAnime/Shokofin/releases/tag/${{ needs.current_info.outputs.tag }}) and installing it manually!
**Changes since last build**:
${{ needs.current_info.outputs.changelog }}
prerelease: true
fail_on_unmatched_files: true
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Dev Manifest
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: metadata
commit_message: "misc: update dev manifest"
file_pattern: dev/manifest.json
skip_fetch: true
discord-notify:
runs-on: ubuntu-latest
name: Send notifications about the new daily build
needs:
- current_info
- build_plugin
steps:
- name: Notify Discord Users
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
embed-color: 9985983
embed-timestamp: ${{ needs.current_info.outputs.date }}
embed-author-name: Shokofin | New Dev Build
embed-author-icon-url: https://raw.githubusercontent.com/${{ github.repository }}/dev/.github/images/jellyfin.png
embed-author-url: https://github.com/${{ github.repository }}
embed-description: |
**Version**: `${{ needs.current_info.outputs.version }}` (`${{ needs.current_info.outputs.sha_short }}`)
Update your plugin using the [dev manifest](https://raw.githubusercontent.com/${{ github.repository }}/metadata/dev/manifest.json) or by downloading the release from [GitHub Releases](https://github.com/${{ github.repository }}/releases/tag/${{ needs.current_info.outputs.tag }}) and installing it manually!
**Changes since last build**:
${{ needs.current_info.outputs.changelog }}