diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-01-05 22:13:27 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-01-05 22:13:27 +0900 |
| commit | 4fe9e26641990f0696ee1841b8e8577ed1eefe55 (patch) | |
| tree | 258cff5e0554d758c26992bbc77aa1956411919f /.github/workflows | |
| download | LunaticChat-4fe9e26641990f0696ee1841b8e8577ed1eefe55.tar.gz LunaticChat-4fe9e26641990f0696ee1841b8e8577ed1eefe55.tar.bz2 LunaticChat-4fe9e26641990f0696ee1841b8e8577ed1eefe55.zip | |
first commit
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/ci.yaml | 41 | ||||
| -rw-r--r-- | .github/workflows/dokka.yaml | 52 | ||||
| -rw-r--r-- | .github/workflows/release.yaml | 125 |
3 files changed, 218 insertions, 0 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..b23385b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,41 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-24.04 + permissions: + contents: read + pull-requests: write + issues: write + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Setup Development Environment + uses: jdx/mise-action@v3 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Check ktlint + run: ./gradlew ktlintCheck --no-daemon + + - name: Build with shadowJar + run: ./gradlew shadowJar --parallel --no-daemon + + - name: Upload build artifact + uses: actions/upload-artifact@v6 + if: success() + with: + name: LunaticChat-${{ github.sha }} + path: build/libs/*-all.jar + retention-days: 7 diff --git a/.github/workflows/dokka.yaml b/.github/workflows/dokka.yaml new file mode 100644 index 0000000..c02d67b --- /dev/null +++ b/.github/workflows/dokka.yaml @@ -0,0 +1,52 @@ +name: Deploy Dokka + +on: + push: + branches: + - main + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Setup Development Environment + uses: jdx/mise-action@v3 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Generate JavaDoc with Dokka + run: ./gradlew dokkaGenerate --no-daemon + + - name: Upload artifact + id: lunaticchat_dokka + uses: actions/upload-pages-artifact@v4 + with: + path: build/dokka/html + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-24.04 + needs: build + steps: + - name: Deploy to GitHub Pages + id: lunaticchat_dokka + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..8cd9cd6 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,125 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + validate: + runs-on: ubuntu-24.04 + outputs: + version: ${{ steps.get_version.outputs.version }} + jar_name: ${{ steps.get_version.outputs.jar_name }} + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Extract version from build.gradle.kts + id: get_version + run: | + VERSION=$(grep '^version = ' build.gradle.kts | sed 's/version = "\(.*\)"/\1/') + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "jar_name=rune-core-$VERSION-all.jar" >> $GITHUB_OUTPUT + echo "Extracted version: $VERSION" + + - name: Validate tag matches version + run: | + TAG_VERSION=${GITHUB_REF#refs/tags/v} + GRADLE_VERSION="${{ steps.get_version.outputs.version }}" + + if [ "$TAG_VERSION" != "$GRADLE_VERSION" ]; then + echo "Error: Tag version ($TAG_VERSION) does not match build.gradle.kts version ($GRADLE_VERSION)" + exit 1 + fi + echo "Version validation passed: $TAG_VERSION" + + - name: Check if release already exists + env: + GH_TOKEN: ${{ github.token }} + run: | + TAG_NAME=${GITHUB_REF#refs/tags/} + if gh release view "$TAG_NAME" &> /dev/null; then + echo "Error: Release $TAG_NAME already exists" + exit 1 + fi + echo "Release validation passed: $TAG_NAME does not exist yet" + + build: + runs-on: ubuntu-24.04 + needs: validate + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Setup Development Environment + uses: jdx/mise-action@v3 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with shadowJar + run: ./gradlew shadowJar --parallel --no-daemon + + - name: Upload build artifact + uses: actions/upload-artifact@v6 + with: + name: LunaticChat-v${{ needs.validate.outputs.version }} + path: build/libs/${{ needs.validate.outputs.jar_name }} + retention-days: 90 + + release: + runs-on: ubuntu-24.04 + needs: [validate, build] + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Download build artifact + uses: actions/download-artifact@v7 + with: + name: LunaticChat-v${{ needs.validate.outputs.version }} + + - name: Get current date + id: get_date + run: echo "current_date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + env: + GH_TOKEN: ${{ github.token }} + run: | + TAG_NAME=${GITHUB_REF#refs/tags/} + VERSION=${{ needs.validate.outputs.version }} + JAR_NAME=${{ needs.validate.outputs.jar_name }} + + gh release create "$TAG_NAME" \ + "$JAR_NAME" \ + --title "$TAG_NAME" \ + --notes "## $TAG_NAME (${{ steps.get_date.outputs.current_date }}) + + Release of version $VERSION. + Please refer to [CHANGELOG.md](./CHANGELOG.md) for update details." + + - name: Publish to Modrinth + uses: cloudnode-pro/modrinth-publish@1b5ffca305e06d3a5cd539f5536cd16c9e502448 # v2 + with: + token: ${{ secrets.MODRINTH_TOKEN }} + name: LunaticChat v${{ needs.validate.outputs.version }} + project: ${{ secrets.MODRINTH_PROJECT_ID }} + version: ${{ needs.validate.outputs.version }} + channel: alpha + featured: true + changelog: | + Release of version ${{ needs.validate.outputs.version }}. + Please refer to [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for update details. + loaders: paper + game-versions: | + 1.21.x + files: | + ${{ needs.validate.outputs.jar_name }} + |
