mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
172 lines
5.2 KiB
YAML
172 lines
5.2 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
info:
|
|
name: Parse release info
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.get_version.outputs.version }}
|
|
version-without-v: ${{ steps.get_version.outputs.version-without-v }}
|
|
changelog: ${{ steps.get_changelog.outputs.changelog }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get Version
|
|
id: get_version
|
|
run: |
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
VERSION_WITHOUT_V=${VERSION#v}
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "version-without-v=$VERSION_WITHOUT_V" >> $GITHUB_OUTPUT
|
|
|
|
- name: Get ChangeLog
|
|
id: get_changelog
|
|
working-directory: .github/scripts
|
|
run: |
|
|
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$(python parse_changelog_of_version.py ${{ steps.get_version.outputs.version }})" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
build-jar:
|
|
name: Build Jar
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 17
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Build Web with Bun
|
|
working-directory: web
|
|
run: bun install --frozen-lockfile && bun run build
|
|
|
|
- name: Build Boot with Gradle
|
|
run: ./gradlew :boot:bootjar -x test
|
|
|
|
- name: Upload Boot Jar
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: boot
|
|
path: boot/build/libs/*.jar
|
|
|
|
docker-push:
|
|
name: Docker Push
|
|
needs: [ info, build-jar ]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download Boot Jar
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: boot
|
|
path: boot/build/libs
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: docker.io
|
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: boot
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
docker.io/reajason/memshell-party:${{ needs.info.outputs.version-without-v }}
|
|
docker.io/reajason/memshell-party:latest
|
|
ghcr.io/reajason/memshell-party:${{ needs.info.outputs.version-without-v }}
|
|
ghcr.io/reajason/memshell-party:latest
|
|
|
|
deploy-maven:
|
|
name: Deploy to Maven Central
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 17
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4
|
|
|
|
- name: Publish with Gradle
|
|
env:
|
|
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }}
|
|
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }}
|
|
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }}
|
|
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }}
|
|
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }}
|
|
run: ./gradlew publishAllToMavenCentral
|
|
|
|
create-release:
|
|
name: Create Release
|
|
needs: [ info, docker-push ]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download Boot Jar
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: boot
|
|
path: boot/build/libs
|
|
|
|
- name: Release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
name: ${{ needs.info.outputs.version }}
|
|
tag: ${{ needs.info.outputs.version }}
|
|
body: ${{ needs.info.outputs.changelog }}
|
|
artifacts: boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar
|
|
|
|
deploy-northflank:
|
|
name: Deploy to Northflank
|
|
needs: [ docker-push ]
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NORTHFLANK_API_KEY: ${{ secrets.NORTHFLANK_API_KEY }}
|
|
steps:
|
|
- name: Update Deployment
|
|
run: |
|
|
curl --header "Content-Type: application/json" \
|
|
--header "Authorization: Bearer $NORTHFLANK_API_KEY" \
|
|
--request POST \
|
|
--data '{"external":{"imagePath":"docker.io/reajason/memshell-party:latest","credentials":"docker-hub"},"docker":{"configType":"default"}}' \
|
|
https://api.northflank.com/v1/projects/memshellparty/services/memshellparty/deployment
|