Skip to content

Commit

Permalink
auto choose build java version and change checkout method
Browse files Browse the repository at this point in the history
java version choose from folia's workflow file
  • Loading branch information
neokoni authored Jan 2, 2025
1 parent dd62c3f commit 66f6bdd
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions .github/workflows/folia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ jobs:
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- uses: actions/checkout@v4
- name: JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'

- name: set-timezone
run: |
sudo timedatectl set-timezone Asia/Shanghai
Expand All @@ -46,6 +39,18 @@ jobs:
run: |
git clone https://github.com/PaperMC/Folia.git ~/folia
- name: get build java version
id: get_build_java_ver1
run: |
echo "::set-output name=get_build_java_ver1::$(cat ~/folia/.github/workflows/build.yml | grep java-version | sed 's/^.........................//'| sed 's/^.................//' | sed 's/.$//')"
- uses: actions/checkout@v4
- name: JDK 21
uses: actions/setup-java@v4
with:
java-version: ${{ steps.get_build_java_ver1.outputs.get_build_java_ver1 }}
distribution: 'zulu'

- name: Get dev branch info
id: dev
run: |
Expand Down Expand Up @@ -133,14 +138,6 @@ jobs:
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- uses: actions/checkout@v4
- name: JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'

- name: set-timezone
run: |
sudo timedatectl set-timezone Asia/Shanghai
Expand All @@ -157,11 +154,22 @@ jobs:
cd ~/folia
echo "::set-output name=dev1::$(git branch -a | grep dev | sed 's/^.................//' | sort -rV )"
- name: Reclone dev branch to build
- name: checkout dev branch
run: |
cd ~
rm -rf folia
git clone https://github.com/papermc/folia -b ${{ steps.dev1.outputs.dev1 }}
cd ~/folia
git checkout ${{ steps.dev1.outputs.dev1 }}
- name: get build java version
id: get_build_java_ver2
run: |
echo "::set-output name=get_build_java_ver2::$(cat ~/folia/.github/workflows/build.yml | grep java-version | sed 's/^.........................//'| sed 's/^.................//' | sed 's/.$//')"
- uses: actions/checkout@v4
- name: JDK 21
uses: actions/setup-java@v4
with:
java-version: ${{ steps.get_build_java_ver2.outputs.get_build_java_ver2 }}
distribution: 'zulu'

- name: applyPathches
run: |
Expand Down

0 comments on commit 66f6bdd

Please sign in to comment.