-
Notifications
You must be signed in to change notification settings - Fork 18
152 lines (123 loc) · 4.9 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
name: Unstable Release
on:
push:
branches: [ master ]
jobs:
current_info:
runs-on: ubuntu-latest
name: Current Information
outputs:
version: ${{ steps.release_info.outputs.version }}
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: true
prefix: v
prefixRegex: "[vV]?"
- name: Get Current Version
id: release_info
uses: revam/gh-action-get-tag-and-version@v1
with:
branch: true
increment: build
prefix: v
prefixRegex: "[vV]?"
- 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"
git log $PREVIOUS_COMMIT..$NEXT_COMMIT --pretty=format:"%B" | grep -v "misc: update unstable manifest" | head -c -2 >> "$GITHUB_OUTPUT"
echo -e "\n$EOF" >> "$GITHUB_OUTPUT"
build_plugin:
runs-on: ubuntu-latest
needs:
- current_info
name: Build & Release (Unstable)
steps:
- name: Checkout
uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- name: Setup .Net
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.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 --version=${{ needs.current_info.outputs.version }} --prerelease=True
- name: Create Pre-Release
uses: softprops/action-gh-release@v1
with:
files: ./artifacts/shoko_*.zip
name: "Shokofin Unstable ${{ needs.current_info.outputs.version }}"
tag_name: ${{ needs.current_info.outputs.version }}
body: |
Update your plugin using the [unstable manifest](https://raw.githubusercontent.com/ShokoAnime/Shokofin/master/manifest-unstable.json) or by downloading the release from [GitHub Releases](https://github.com/ShokoAnime/Shokofin/releases/tag/${{ needs.current_info.outputs.version }}) and installing it manually!
**Changes since last build**:
${{ needs.current_info.outputs.changelog }}
prerelease: true
fail_on_unmatched_files: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Unstable Manifest
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: master
commit_message: "misc: update unstable manifest"
file_pattern: manifest-unstable.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: Ilshidur/action-discord@08d9328877d6954120eef2b07abbc79249bb6210
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: |
# <:jellyfin:1045360407814090953> Shokofin: New Unstable Build!
**Version**: `${{ needs.current_info.outputs.version }}` (`${{ needs.current_info.outputs.sha_short }}`)
Update your plugin using the [unstable manifest](<https://raw.githubusercontent.com/ShokoAnime/Shokofin/master/manifest-unstable.json>) or by downloading the release from [GitHub Releases](<https://github.com/ShokoAnime/Shokofin/releases/tag/${{ needs.current_info.outputs.version }}>) and installing it manually!
**Changes since last build**:
${{ needs.current_info.outputs.changelog }}