Compare commits
4 Commits
dev
...
build-9679
| Author | SHA1 | Date | |
|---|---|---|---|
| 96792a0091 | |||
| 08bd2aa272 | |||
| 4e70c0e57e | |||
| dbee665fd5 |
@@ -1,4 +1,4 @@
|
||||
name: Main Release
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,6 +6,7 @@ on:
|
||||
- main
|
||||
tags:
|
||||
- "v*"
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
@@ -14,21 +15,31 @@ permissions:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: gradle:8.11.1-jdk21
|
||||
env:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
GITEA_API_URL: ${{ github.server_url }}/api/v1
|
||||
GITEA_REPO: ${{ github.repository }}
|
||||
GITEA_REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
|
||||
GITEA_REF_NAME: ${{ github.ref_name }}
|
||||
GITEA_SHA: ${{ github.sha }}
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare source
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
if [ ! -f build.gradle ]; then
|
||||
git -c http.extraHeader="Authorization: token ${GITEA_TOKEN}" \
|
||||
clone --depth 1 "${GITEA_REPO_URL}" .
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash ./gradlew --no-daemon build
|
||||
gradle --no-daemon build
|
||||
|
||||
- name: Publish Gitea release
|
||||
if: github.event_name != 'pull_request'
|
||||
@@ -38,12 +49,12 @@ jobs:
|
||||
|
||||
jar_path="$(ls -1 build/libs/*.jar | head -n 1)"
|
||||
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
||||
release_tag="${GITHUB_REF_NAME}"
|
||||
release_name="${GITHUB_REF_NAME}"
|
||||
release_tag="${GITEA_REF_NAME}"
|
||||
release_name="${GITEA_REF_NAME}"
|
||||
prerelease=false
|
||||
else
|
||||
release_tag="build-${GITHUB_SHA:0:7}"
|
||||
release_name="build-${GITHUB_SHA:0:7}"
|
||||
release_tag="build-${GITEA_SHA:0:7}"
|
||||
release_name="build-${GITEA_SHA:0:7}"
|
||||
prerelease=true
|
||||
fi
|
||||
|
||||
@@ -51,10 +62,10 @@ jobs:
|
||||
"${release_tag}" "${release_name}" "${release_name}" "${prerelease}")"
|
||||
|
||||
release_json="$(curl -fsS \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "${release_payload}" \
|
||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases")"
|
||||
"${GITEA_API_URL}/repos/${GITEA_REPO}/releases")"
|
||||
|
||||
release_id="$(printf '%s' "${release_json}" | sed -n 's/.*"id":[[:space:]]*\([0-9][0-9]*\).*/\1/p' | head -n 1)"
|
||||
if [ -z "${release_id}" ]; then
|
||||
@@ -63,16 +74,8 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_SERVER_URL}" == "https://github.com" ]]; then
|
||||
curl -fsS \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"${jar_path}" \
|
||||
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=$(basename "${jar_path}")"
|
||||
else
|
||||
curl -fsS \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "attachment=@${jar_path}" \
|
||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=$(basename "${jar_path}")"
|
||||
fi
|
||||
curl -fsS \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "attachment=@${jar_path}" \
|
||||
"${GITEA_API_URL}/repos/${GITEA_REPO}/releases/${release_id}/assets?name=$(basename "${jar_path}")"
|
||||
|
||||
29
.github/workflows/dev-verify.yml
vendored
29
.github/workflows/dev-verify.yml
vendored
@@ -1,29 +0,0 @@
|
||||
name: Dev Verify
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
|
||||
- name: Verify
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash ./gradlew --no-daemon compileClientJava
|
||||
78
.github/workflows/main-release.yml
vendored
78
.github/workflows/main-release.yml
vendored
@@ -1,78 +0,0 @@
|
||||
name: Main Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash ./gradlew --no-daemon build
|
||||
|
||||
- name: Publish release
|
||||
if: github.event_name != 'pull_request'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
jar_path="$(ls -1 build/libs/*.jar | head -n 1)"
|
||||
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
||||
release_tag="${GITHUB_REF_NAME}"
|
||||
release_name="${GITHUB_REF_NAME}"
|
||||
prerelease=false
|
||||
else
|
||||
release_tag="build-${GITHUB_SHA:0:7}"
|
||||
release_name="build-${GITHUB_SHA:0:7}"
|
||||
prerelease=true
|
||||
fi
|
||||
|
||||
release_payload="$(printf '{"tag_name":"%s","name":"%s","body":"Automated build for %s.","draft":false,"prerelease":%s}' \
|
||||
"${release_tag}" "${release_name}" "${release_name}" "${prerelease}")"
|
||||
|
||||
release_json="$(curl -fsS \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "${release_payload}" \
|
||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases")"
|
||||
|
||||
release_id="$(printf '%s' "${release_json}" | sed -n 's/.*"id":[[:space:]]*\([0-9][0-9]*\).*/\1/p' | head -n 1)"
|
||||
if [ -z "${release_id}" ]; then
|
||||
echo "Failed to parse release ID from response:"
|
||||
printf '%s\n' "${release_json}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_SERVER_URL}" == "https://github.com" ]]; then
|
||||
curl -fsS \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"${jar_path}" \
|
||||
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=$(basename "${jar_path}")"
|
||||
else
|
||||
curl -fsS \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "attachment=@${jar_path}" \
|
||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=$(basename "${jar_path}")"
|
||||
fi
|
||||
Reference in New Issue
Block a user