Deleted docs/CODE_OF_CONDUCT.md #34
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: Version Incrementer | |
on: | |
push: | |
branches: | |
- 1.8.9 | |
jobs: | |
version-incrementer: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Get current version | |
id: get_version | |
run: | | |
current_version=$(grep 'version = ' src/main/java/com/SwingTheVine/QSAND/ModInfo.java | cut -d '"' -f2) | |
echo "Current version: $current_version" | |
echo "current_version=$current_version" >> $GITHUB_OUTPUT | |
- name: Version increment | |
id: version_increment | |
run: | | |
current_version=${{ steps.get_version.outputs.current_version }} | |
major=$(echo $current_version | cut -d'.' -f1) | |
minor=$(echo $current_version | cut -d'.' -f2) | |
patch=$(echo $current_version | cut -d'.' -f3) | |
new_minor=$((minor + 1)) | |
new_version="$major.$new_minor.0" | |
echo "New version: $new_version" | |
echo "new_version=$new_version" >> $GITHUB_OUTPUT | |
- name: Update versions in multiple files | |
run: | | |
new_version=${{ steps.version_increment.outputs.new_version }} | |
if [ -f "src/main/java/com/SwingTheVine/QSAND/ModInfo.java" ]; then | |
echo "ModInfo.java exists. Modifying..." | |
else | |
echo "ModInfo.java was not found. Skipping..." | |
fi | |
sed -i 's/version = "[^"]*"/version = "'$new_version'"/' src/main/java/com/SwingTheVine/QSAND/ModInfo.java | |
if [ -f "src/main/resources/mcmod.info" ]; then | |
echo "mcmod.info exists. Modifying..." | |
else | |
echo "mcmod.info was not found. Skipping..." | |
fi | |
sed -i 's/"version": "[^"]*"/"version": "'$new_version'"/' src/main/resources/mcmod.info | |
if [ -f "docs/README.md" ]; then | |
echo "README.md exists. Modifying..." | |
else | |
echo "README.md was not found. Skipping..." | |
fi | |
sed -i 's/\(Latest_Version-[0-9.]*--\)[^?]*/\1'$new_version'-lightblue/' docs/README.md | |
- name: Get the previous commit message | |
id: get-commit-message | |
run: echo "::set-output name=MSG::$(git log -1 --pretty=%B)" | |
- name: Commit changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add src/main/java/com/SwingTheVine/QSAND/ModInfo.java | |
git add src/main/resources/mcmod.info | |
git add docs/README.md | |
git commit -m "Incremented version to ${{ steps.version_increment.outputs.new_version }} from ${{ steps.get_version.outputs.current_version }}; ${{ steps.get-commit-message.outputs.MSG }}" | |
git push |