Dev (#25) #23
This file contains hidden or 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: GregTech-Construct Build | |
| on: | |
| push: | |
| branches: ["main"] | |
| # pull_request: | |
| # branches: ["main"] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Build with Gradle | |
| run: ./gradlew build --info | |
| - name: Get workflow timestamp | |
| id: timestamp | |
| run: echo "TIMESTAMP=$(TZ='Asia/Shanghai' date +'%Y%m%d-%H-%M')" >> $GITHUB_ENV | |
| - name: Rename JAR | |
| run: | | |
| cd build/libs | |
| for f in *.jar; do | |
| mv "$f" "${f%.jar}-SNAPSHOT-$TIMESTAMP.jar" | |
| done | |
| shell: bash | |
| - name: Upload JAR file | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: GregTech-Construct | |
| path: build/libs/*.jar | |
| compression-level: 0 |