From 7f8d65fe67fc9172e0521c7a7ee35918bed46f83 Mon Sep 17 00:00:00 2001 From: Shiina Kin Date: Wed, 11 Sep 2024 20:23:55 +0800 Subject: [PATCH] chore: add ci action --- .github/workflows/ci.yml | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..a7d887a1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,67 @@ +name: CI + +on: + push: + branches: + - main + tags: + - 'v*.*.*' + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: temurin + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Setup Node 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Build with Gradle Wrapper + run: chmod +x ./gradlew && ./gradlew build + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: hoshizora-pics-artifact + path: build + retention-days: 1 + + release: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: hoshizora-pics-artifact + path: build + + - name: Generate Changelog + run: echo "# Good things have arrived" > ${{ github.workspace }}-CHANGELOG.txt + + - name: release + uses: softprops/action-gh-release@v2 + with: + body_path: ${{ github.workspace }}-CHANGELOG.txt + files: build/*