This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
chore(version): update changelog and version.txt #53
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |