test release workflow #30
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: compile mikupad | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
- name: run compile.sh | ||
run: chmod +x compile.sh; ./compile.sh | ||
- name: Commit and push changes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git add -f mikupad_compiled.html | ||
git commit -m "Update mikupad_compiled.html" || echo "No changes to commit" | ||
git push origin main || echo "Nothing to push" | ||
- name: Get Commit Count | ||
id: commit_count | ||
run: echo "::set-output name=count::$(git rev-list --count HEAD)" | ||
- name: Get Last Release Tag | ||
id: last_release | ||
run: echo "::set-output name=tag::$(git describe --tags --abbrev=0 HEAD^)" | ||
- name: Generate Changelog | ||
id: changelog | ||
run: | | ||
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^) | ||
echo "Generating changelog from $LAST_TAG" | ||
echo "$(git log $LAST_TAG..HEAD --oneline)" > CHANGELOG.txt | ||
echo "::set-output name=body::$(cat CHANGELOG.txt)" | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: v${{ steps.commit_count.outputs.count }} | ||
name: V${{ steps.commit_count.outputs.count }} | ||
body: ${{ steps.changelog.outputs.body }} | ||
files: mikupad_compiled.html | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 |