93 lines
3.4 KiB
Bash
Executable File
93 lines
3.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# exdev Jenkins — goldenChart-Desktop-Pipeline Job 생성
|
|
set -euo pipefail
|
|
|
|
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:${PATH:-/usr/bin:/bin}"
|
|
|
|
JENKINS_HOME="${JENKINS_HOME:-$HOME/.jenkins}"
|
|
JENKINS_JOB="goldenChart-Desktop-Pipeline"
|
|
JENKINS_TRIGGER_TOKEN="${JENKINS_DESKTOP_TRIGGER_TOKEN:-${GC_DESKTOP_JENKINS_TRIGGER_TOKEN:-goldenchart-desktop-build}}"
|
|
GIT_DIR="${GIT_DIR:-/Volumes/ADATA/git/goldenChart.git}"
|
|
WORK_TREE="${WORK_TREE:-/Users/aidev/apps/goldenChart}"
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
log() { echo "[install-desktop-jenkins] $*"; }
|
|
|
|
log "Jenkins job 생성: $JENKINS_JOB"
|
|
mkdir -p "${JENKINS_HOME}/jobs/${JENKINS_JOB}"
|
|
|
|
cat > "${JENKINS_HOME}/jobs/${JENKINS_JOB}/config.xml" << JENKINS_XML
|
|
<?xml version='1.1' encoding='UTF-8'?>
|
|
<project>
|
|
<description>GoldenChart Desktop — Tauri macOS dmg + Windows NSIS + updater</description>
|
|
<keepDependencies>false</keepDependencies>
|
|
<properties/>
|
|
<scm class="hudson.plugins.git.GitSCM" plugin="git@5.0.0">
|
|
<configVersion>2</configVersion>
|
|
<userRemoteConfigs>
|
|
<hudson.plugins.git.UserRemoteConfig>
|
|
<url>file://${GIT_DIR}</url>
|
|
</hudson.plugins.git.UserRemoteConfig>
|
|
</userRemoteConfigs>
|
|
<branches>
|
|
<hudson.plugins.git.BranchSpec>
|
|
<name>*/main</name>
|
|
</hudson.plugins.git.BranchSpec>
|
|
</branches>
|
|
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
|
<submoduleCfg class="empty-list"/>
|
|
<extensions/>
|
|
</scm>
|
|
<canRoam>true</canRoam>
|
|
<disabled>false</disabled>
|
|
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
|
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
|
<authToken>${JENKINS_TRIGGER_TOKEN}</authToken>
|
|
<triggers/>
|
|
<concurrentBuild>false</concurrentBuild>
|
|
<builders>
|
|
<hudson.tasks.Shell>
|
|
<command>#!/bin/bash
|
|
set -euo pipefail
|
|
export PATH="/opt/homebrew/opt/llvm/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:\$PATH"
|
|
export WORK_TREE="${WORK_TREE}"
|
|
export GIT_DIR="${GIT_DIR}"
|
|
export BUILD_NUMBER="\${BUILD_NUMBER}"
|
|
export TAURI_SIGNER_KEY="\${TAURI_SIGNER_KEY:-\$HOME/.tauri/goldenchart.key}"
|
|
export DESKTOP_BUMP_ON_CI=1
|
|
export DESKTOP_DEPLOY_WEB=0
|
|
export DESKTOP_UPDATE_BASE_URL="${DESKTOP_UPDATE_BASE_URL:-http://exdev.co.kr/desktop/updates}"
|
|
"${WORK_TREE}/scripts/jenkins-desktop-pipeline.sh"
|
|
</command>
|
|
</hudson.tasks.Shell>
|
|
</builders>
|
|
<publishers>
|
|
<hudson.tasks.ArtifactArchiver>
|
|
<artifacts>dist-desktop/**</artifacts>
|
|
<allowEmptyArchive>true</allowEmptyArchive>
|
|
<onlyIfSuccessful>false</onlyIfSuccessful>
|
|
<fingerprint>false</fingerprint>
|
|
<defaultExcludes>true</defaultExcludes>
|
|
</hudson.tasks.ArtifactArchiver>
|
|
</publishers>
|
|
<buildWrappers/>
|
|
</project>
|
|
JENKINS_XML
|
|
|
|
if curl -sf -o /dev/null "http://127.0.0.1:8090/login" 2>/dev/null; then
|
|
curl -sf -X POST "http://127.0.0.1:8090/reload" 2>/dev/null || true
|
|
fi
|
|
|
|
log "완료: http://127.0.0.1:8090/job/${JENKINS_JOB}/"
|
|
log "원격 트리거 토큰: $JENKINS_TRIGGER_TOKEN"
|
|
log "backend env: GC_DESKTOP_JENKINS_TRIGGER_TOKEN=$JENKINS_TRIGGER_TOKEN"
|
|
log ""
|
|
log "Jenkins Credentials (Secret file):"
|
|
log " ID: tauri-signer-key → \$HOME/.tauri/goldenchart.key"
|
|
log ""
|
|
log "최초 1회 (서버):"
|
|
log " ./scripts/install-desktop-build-deps.sh"
|
|
log " ./scripts/setup-desktop-updater-keys.sh"
|
|
log " git add desktop/updater.pub && git commit"
|