This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (96 loc) · 3.38 KB
/
release.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
name: Release Template
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
- name: Get Base SHA
id: get-base-sha
run: |
echo "base_sha=$(git rev-parse "$(git tag --sort=-v:refname | head -n 2 | tail -n 1)")" >> $GITHUB_OUTPUT
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@main
with:
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
files: |
mkdocs.yml
docs/**
overrides/**
find_unused_media.py
- name: create zip of changed files
if: steps.changed-files.outputs.any_changed == 'true'
run: |
mkdir -p changed_files
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file added to zip"
mkdir -p changed_files/$(dirname $file)
cp $file changed_files/$file
done
cd changed_files
zip -r changed_files.zip .
mv changed_files.zip ../
cd ..
- name: Create zip of all files
run : |
zip -r release.zip docs/ overrides/ find_unused_media.py
mv version.txt update.txt
- name: create changelog
run: |
npx rexreplace "^.*?#+\s\[.*?\n.*?(?=\s*#+\s\[)" "_" -s -M -G -m -o "CHANGELOG.md" > body_changelog.md
echo "## Edited files" > CHANGELOG-LATEST.md
echo "" >> CHANGELOG-LATEST.md
echo "### Added" >> CHANGELOG-LATEST.md
echo "" >> CHANGELOG-LATEST.md
for file in ${{ steps.changed-files.outputs.added_files }}; do
echo "- [$file]($file)" >> CHANGELOG-LATEST.md
done
echo "### Modified" >> CHANGELOG-LATEST.md
echo "" >> CHANGELOG-LATEST.md
for file in ${{ steps.changed-files.outputs.modified_files }}; do
echo "- [$file]($file)" >> CHANGELOG-LATEST.md
done
echo "### Removed" >> CHANGELOG-LATEST.md
echo "" >> CHANGELOG-LATEST.md
for file in ${{ steps.changed-files.outputs.deleted_files }}; do
echo "- [$file]($file)" >> CHANGELOG-LATEST.md
done
echo "### Renamed" >> CHANGELOG-LATEST.md
echo "" >> CHANGELOG-LATEST.md
for file in ${{ steps.changed-files.outputs.renamed_files }}; do
echo "- [$file]($file)" >> CHANGELOG-LATEST.md
done
echo "" >> CHANGELOG-LATEST.md
echo "---" >> CHANGELOG-LATEST.md
echo "## Changelog" >> CHANGELOG-LATEST.md
echo "" >> CHANGELOG-LATEST.md
cat body_changelog.md >> CHANGELOG-LATEST.md
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref }}
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body_path: CHANGELOG-LATEST.md
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
files: |
update.txt
README.md
CHANGELOG.md
LICENSE
release.zip
changed_files.zip