Update GitHub actions

This commit is contained in:
KingRainbow44 2023-05-31 23:22:54 -04:00
parent e0a2ccf49c
commit 28cb202d2b
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
5 changed files with 40 additions and 68 deletions

View File

@ -8,7 +8,6 @@ on:
- "stable" - "stable"
- "development" - "development"
- "unstable" - "unstable"
- "unstable-quests"
pull_request: pull_request:
paths: paths:
- "**.java" - "**.java"

View File

@ -7,6 +7,7 @@ on:
- "src/main/**.java" - "src/main/**.java"
- "**.json" - "**.json"
branches: branches:
- "development"
- "unstable" - "unstable"
jobs: jobs:
@ -17,6 +18,10 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Setup Java - name: Setup Java
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
@ -38,10 +43,36 @@ jobs:
- run: git config --global user.name "github-actions" - run: git config --global user.name "github-actions"
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git stash - run: git stash
- run: git checkout unstable && git pull - run: git checkout ${{ steps.extract_branch.outputs.branch }} && git pull
- run: git stash pop || true - run: git stash pop || true
- name: Commit Code Changes - name: Commit Code Changes
run: git add -u && git commit -m 'Format code [skip actions]' || true run: git add -u && git commit -m 'Format code [skip actions]' || true
- name: Push Code Changes - name: Push Code Changes
run: git push --set-upstream --force origin unstable run: git push --set-upstream --force origin ${{ steps.extract_branch.outputs.branch }}
Update-Languages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Update Languages
run: python scripts/manage_languages.py -u
- run: git config --global user.name "github-actions"
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git stash
- run: git checkout ${{ steps.extract_branch.outputs.branch }} && git pull
- run: git stash pop || true
- name: Commit any language changes
run: git add -u && git commit -m 'Update languages [skip actions]' || true
- name: Push language changes
run: git push --set-upstream --force origin ${{ steps.extract_branch.outputs.branch }}

View File

@ -22,6 +22,10 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
@ -45,14 +49,14 @@ jobs:
- run: git config --global user.name "github-actions" - run: git config --global user.name "github-actions"
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git stash - run: git stash
- run: git checkout unstable && git pull - run: git checkout ${{ steps.extract_branch.outputs.branch }} && git pull
- run: git stash pop || true - run: git stash pop || true
- name: Commit changes - name: Commit changes
if: ${{ github.event_name == 'push' }} if: ${{ github.event_name == 'push' }}
run: git add -u && git commit -m "Lint Code [skip actions]" || true run: git add -u && git commit -m "Lint Code [skip actions]" || true
- name: Push changes - name: Push changes
if: ${{ github.event_name == 'push' }} if: ${{ github.event_name == 'push' }}
run: git push --set-upstream --force origin unstable run: git push --set-upstream --force origin ${{ steps.extract_branch.outputs.branch }}
Build-Handbook: Build-Handbook:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -10,6 +10,7 @@ on:
branches: branches:
- "stable" - "stable"
- "development" - "development"
- "unstable"
pull_request: pull_request:
paths: paths:
- ".github/workflows/**" - ".github/workflows/**"

View File

@ -1,63 +0,0 @@
name: "Lint whitespace and languages"
on:
workflow_dispatch: ~
push:
paths:
- ".github/workflows/**"
- "src/main/**.java"
- "**.json"
- "build.gradle"
- "scripts/format_whitespace.py"
- "scripts/manage_languages.py"
branches:
- "development"
jobs:
Make-Lint-Commits:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run Whitespace Linter
run: python scripts/format_whitespace.py
- run: git config --global user.name "github-actions"
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git stash
- run: git checkout LintRatchet
# - run: git merge development
- run: git reset --hard development
- run: git stash pop || true
- name: Commit any whitespace changes
run: git add -u && git commit -m 'Fix whitespace [skip actions]' || true
- name: Update Languages
run: python scripts/manage_languages.py -u
- name: Commit any language changes
run: git add -u && git commit -m 'Update languages [skip actions]' || true
- name: Bump version to a release
# a.b.c-dev -> a.b.c
# If any breaking changes, a.b.c-dev -> a.(b+1).0
run: |
export BREAKING=`git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%s" --grep="BREAKING"`
if [[ $BREAKING ]]; then export NEXT_VERSION=`sed -nr "s/^version = '(.*\.)([0-9]+)\.[0-9]+(-dev)?'"'/echo "\1$((\2+1)).0"/ep' build.gradle`; else export NEXT_VERSION=`sed -nr "s/^version = '(.*)-dev'/\1/p" build.gradle`; fi
export CHANGELOG=`git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%s"`
perl -pi -e "s/version = '.*'/version = '$NEXT_VERSION'/g" build.gradle
git add build.gradle && git commit -m "Version $NEXT_VERSION" -m "$CHANGELOG"
- name: Bump version to next dev
# a.b.c -> a.b.(c+1)-dev
run: |
export NEXT_VERSION=`sed -nr "s/^version = '(.*)([0-9]+)'"'/echo "\1$((\2+1))-dev"/ep' build.gradle`
perl -pi -e "s/version = '.*'/version = '$NEXT_VERSION'/g" build.gradle
git add build.gradle && git commit -m "Version $NEXT_VERSION [skip actions]"
- name: Force-push changes to LintRatchet
run: git push --set-upstream --force origin LintRatchet