Release v1.1.2 #1
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: "Build and Release SaltyQQChat" | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
name: "Build, Package and Release" | |
steps: | |
- name: "Checkout Code" | |
uses: actions/checkout@v4 | |
- name: "Install Python" | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3 python3-pip | |
- name: "Check Version from Tag and Files" | |
id: check_version | |
run: | | |
TAG_VERSION="${GITHUB_REF##*/}" | |
PLUGIN_VERSION=$(jq -r '.version' mcdreforged.plugin.json) | |
PYTHON_VERSION=$(python3 -c "from salty_qq_chat import __init__; print(__init__.VERSION_STR)") | |
echo "Tag version: $TAG_VERSION" | |
echo "Plugin version from mcdreforged.plugin.json: $PLUGIN_VERSION" | |
echo "Python VERSION_STR: $PYTHON_VERSION" | |
if [ "$TAG_VERSION" != "$PLUGIN_VERSION" ]; then | |
echo "Version mismatch: Tag version and plugin.json version do not match." | |
exit 1 | |
elif [ "$TAG_VERSION" != "$PYTHON_VERSION" ]; then | |
echo "Version mismatch: Tag version and Python VERSION_STR do not match." | |
exit 1 | |
elif [ "$PLUGIN_VERSION" != "$PYTHON_VERSION" ]; then | |
echo "Version mismatch: Plugin version and Python VERSION_STR do not match." | |
exit 1 | |
else | |
echo "Version match: Proceeding with the build." | |
fi | |
- name: "Build and Package the Plugin" | |
run: | | |
mkdir -p dist | |
tar -czf dist/SaltyQQChat-${TAG_VERSION}.mcdr * | |
- name: "Upload Artifact" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "SaltyQQChat-${TAG_VERSION}.mcdr" | |
path: dist/SaltyQQChat-${TAG_VERSION}.mcdr | |
- name: "Create GitHub Release" | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: ${{ contains(github.ref, 'pre') }} | |
files: | | |
dist/SaltyQQChat-${TAG_VERSION}.mcdr |