Skip to content

Add friend match and misc fixes #29

Add friend match and misc fixes

Add friend match and misc fixes #29

Workflow file for this run

name: Compile userscript
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Build
run: python script/build.py
- name: Get previous commit hash
run: echo "PREVIOUS_COMMIT_HASH=$(git rev-parse HEAD^)" >> $GITHUB_ENV
- name: Set env
run: |
VERSION=$(cat templates/version)
echo "VERSION=$VERSION" >> $GITHUB_ENV
LATEST_RELEASE_VERSION=$(git show $PREVIOUS_COMMIT_HASH:templates/version)
if [ -z "$LATEST_RELEASE_VERSION" ]; then
LATEST_RELEASE_VERSION="0.0"
fi
echo "LATEST_RELEASE_VERSION=$LATEST_RELEASE_VERSION" >> $GITHUB_ENV
if ! printf '%s\n' "$VERSION" "$LATEST_RELEASE_VERSION" | sort -C -V; then
echo "SHOULD_RELEASE=true" >> $GITHUB_ENV
fi
- name: Get commit history
if: ${{ env.SHOULD_RELEASE == 'true' }}
run: |
commits=$(git log -n 20 --pretty=format:"- %h - %as: %s")
CURRENT_COMMIT_VERSION=$LATEST_RELEASE_VERSION
while IFS= read -r COMMIT; do
COMMIT_SHA=$(echo $COMMIT | cut -c3-9)
COMMIT_VERSION=$(git show $COMMIT_SHA:templates/version)
if ! printf '%s\n' "$LATEST_RELEASE_VERSION" "$COMMIT_VERSION" | sort -C -V; then
break
fi
if [ "$CURRENT_COMMIT_VERSION" != "$COMMIT_VERSION" ]; then
CURRENT_COMMIT_VERSION=$COMMIT_VERSION
echo "#$CURRENT_COMMIT_VERSION" >> commit_history.md
fi
echo $COMMIT >> commit_history.md
done <<< "$COMMIT_LOG"
- name: Draft release
if: ${{ env.SHOULD_RELEASE == 'true' }}
uses: softprops/action-gh-release@v2
with:
body_path: commit_history.md
draft: true
files: ASF-STM.user.js
name: ASF-STM-plus V${{ env.VERSION }}
tag_name: ${{ env.VERSION }}