Skip to content

leaf

leaf #49

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: leaf
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: "0 16 * * *"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build-default-branch:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: set the git information
run: |
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
# Runs a set of commands using the runners shell
- name: clone leaf repo
run: |
git clone https://github.com/Winds-Studio/Leaf.git ~/leaf
- name: applyPathches
run: |
cd ~/leaf
./gradlew applyPatches
- name: building...
run: |
cd ~/leaf
./gradlew createMojmapPaperclipJar
# Get the date of the build
- name: Get date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: get jar file name
id: get_name
run: echo "::set-output name=name::$(ls ~/leaf/build/libs/ | grep clip)"
# Create a release with the date as the title and tag
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.date.outputs.date }}-${{ github.run_id }}
release_name: ${{ steps.date.outputs.date }}
draft: false
prerelease: false
# Upload the jar file to the release as an asset
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/leaf/build/libs/${{ steps.get_name.outputs.name }}
asset_name: ${{ steps.get_name.outputs.name }}
asset_content_type: application/java-archive
- name: set upload_url
id: set_upload_url
uses: noobly314/share-data@v1
with:
share-id: release_url
mode: set
key: url
value: ${{ steps.create_release.outputs.upload_url }}
permissions:
contents: write
build-dev-branch:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: build-default-branch
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: set the git information
run: |
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
# Runs a set of commands using the runners shell
- name: clone leaf repo
run: |
git clone https://github.com/Winds-Studio/Leaf.git ~/leaf
- name: Get dev branch info
id: dev1
run: |
cd ~/leaf
echo "::set-output name=dev1::$(git branch -a | grep dev | sed 's/^.................//' )"
- name: Reclone dev branch to build
run: |
cd ~
rm -rf leaf
git clone https://github.com/Winds-Studio/leaf -b ${{ steps.dev1.outputs.dev1 }}
- name: applyPathches
run: |
cd ~/leaf
./gradlew applyPatches
- name: building...
run: |
cd ~/leaf
./gradlew createMojmapPaperclipJar
# Get the date of the build
- name: Get date
id: date1
run: echo "::set-output name=date1::$(date +'%Y-%m-%d')"
- name: get jar file name
id: get_name1
run: echo "::set-output name=name1::$(ls ~/leaf/build/libs/ | grep clip)"
- name: get upload_url
id: get_upload_url
uses: noobly314/share-data@v1
with:
share-id: release_url
mode: get
key: url
# Upload the jar file to the release as an asset
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_upload_url.outputs.data }}
asset_path: /home/runner/leaf/build/libs/${{ steps.get_name1.outputs.name1 }}
asset_name: ${{ steps.get_name1.outputs.name1 }}
asset_content_type: application/java-archive
permissions:
contents: write