-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
122 lines (116 loc) 路 5.25 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
122 lines (116 loc) 路 5.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
stages:
- build
- release
variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}"
RUST_VERSION: "stable"
# --- JOB: Build Linux ---
build-linux:
stage: build
image: rust:latest
rules:
- if: $CI_COMMIT_TAG =~ /^v/
script:
- "apt-get update && apt-get install -y jq wget xz-utils file"
- "VERSION=$(cargo pkgid -p seedctl | sed 's/.*#//')"
- "rustup target add x86_64-unknown-linux-gnu"
- "cargo build --release --target x86_64-unknown-linux-gnu"
- "wget -O appimagetool.AppImage https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
- "chmod +x appimagetool.AppImage"
- "./appimagetool.AppImage --appimage-extract"
- "mv squashfs-root appimagetool"
- "cp -r .github/AppImage AppDir-build"
- "mkdir -p AppDir-build/usr/bin"
- "strip target/x86_64-unknown-linux-gnu/release/seedctl || true"
- "cp target/x86_64-unknown-linux-gnu/release/seedctl AppDir-build/usr/bin/seedctl"
- "mkdir -p dist"
- "./appimagetool/AppRun AppDir-build dist/seedctl-${VERSION}-linux-x86_64.AppImage"
- "cp target/x86_64-unknown-linux-gnu/release/seedctl dist/seedctl-${VERSION}-linux-x86_64"
- "echo $VERSION > dist/version.txt"
artifacts:
paths:
- dist/
# --- JOB: Build macOS ---
build-macos-aarch64:
stage: build
tags:
- saas-macos-medium-m1
image: macos-26-xcode-26
rules:
- if: $CI_COMMIT_TAG =~ /^v/
script:
- 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_VERSION"'
- 'source "$HOME/.cargo/env"'
- "VERSION=$(cargo pkgid -p seedctl | sed 's/.*#//')"
- "rustup target add aarch64-apple-darwin"
- "MACOSX_DEPLOYMENT_TARGET=11.0 cargo build --release --target aarch64-apple-darwin"
- "mkdir -p dist"
- "cp target/aarch64-apple-darwin/release/seedctl dist/seedctl-${VERSION}-macos-aarch64"
artifacts:
paths:
- dist/
# --- JOB: Build Windows ---
build-windows:
stage: build
tags:
- saas-windows-medium-amd64
rules:
- if: $CI_COMMIT_TAG =~ /^v/
script:
- 'Invoke-WebRequest -Uri "https://win.rustup.rs/x86_64" -OutFile "rustup-init.exe"'
- '.\rustup-init.exe -y --default-toolchain $env:RUST_VERSION --default-host x86_64-pc-windows-msvc'
- '$env:Path = "$env:USERPROFILE\.cargo\bin;$env:Path"'
- '$VERSION = ((cargo pkgid -p seedctl) -split "#")[-1]'
- 'rustup target add x86_64-pc-windows-msvc'
- 'cargo build --release --target x86_64-pc-windows-msvc'
- 'New-Item -ItemType Directory -Force -Path dist'
- 'Copy-Item "target\x86_64-pc-windows-msvc\release\seedctl.exe" "dist\seedctl-$VERSION-windows-x86_64.exe"'
artifacts:
paths:
- dist/
# --- JOB: Release (Sintaxe Blindada) ---
release-creation:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG =~ /^v/
needs:
- job: build-linux
artifacts: true
- job: build-windows
artifacts: true
- job: build-macos-aarch64
artifacts: true
before_script:
- "apk add --no-cache gnupg curl bash"
script:
- "cd dist"
- "sha256sum seedctl-* > SHA256SUMS"
- 'printf "%s" "$GPG_PRIVATE_KEY" | gpg --batch --import'
- 'echo "$GPG_PASSPHRASE" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --armor --detach-sign SHA256SUMS'
# Uploads com caminhos expl铆citos para evitar erros de expans茫o de shell
- "curl --header \"JOB-TOKEN: $CI_JOB_TOKEN\" --upload-file SHA256SUMS \"${PACKAGE_REGISTRY_URL}/SHA256SUMS\""
- "curl --header \"JOB-TOKEN: $CI_JOB_TOKEN\" --upload-file SHA256SUMS.asc \"${PACKAGE_REGISTRY_URL}/SHA256SUMS.asc\""
# Usando comandos shell simples para capturar os nomes
- "FILE_APPIMAGE=$(ls seedctl-*-linux-x86_64.AppImage) && curl --header \"JOB-TOKEN: $CI_JOB_TOKEN\" --upload-file \"$FILE_APPIMAGE\" \"${PACKAGE_REGISTRY_URL}/seedctl-linux-x86_64.AppImage\""
- "FILE_EXE=$(ls seedctl-*-windows-x86_64.exe) && curl --header \"JOB-TOKEN: $CI_JOB_TOKEN\" --upload-file \"$FILE_EXE\" \"${PACKAGE_REGISTRY_URL}/seedctl-windows-x86_64.exe\""
- "FILE_RAW=$(ls seedctl-*-linux-x86_64) && curl --header \"JOB-TOKEN: $CI_JOB_TOKEN\" --upload-file \"$FILE_RAW\" \"${PACKAGE_REGISTRY_URL}/seedctl-linux-x86_64\""
- "FILE_MACOS_ARM=$(ls seedctl-*-macos-aarch64 2>/dev/null || true); if [ -n \"$FILE_MACOS_ARM\" ]; then curl --header \"JOB-TOKEN: $CI_JOB_TOKEN\" --upload-file \"$FILE_MACOS_ARM\" \"${PACKAGE_REGISTRY_URL}/seedctl-macos-aarch64\"; fi"
release:
name: "Version $CI_COMMIT_TAG"
description: "Automatic release for version $CI_COMMIT_TAG"
tag_name: "$CI_COMMIT_TAG"
assets:
links:
- name: "Linux AppImage"
url: "${PACKAGE_REGISTRY_URL}/seedctl-linux-x86_64.AppImage"
- name: "Windows Executable"
url: "${PACKAGE_REGISTRY_URL}/seedctl-windows-x86_64.exe"
- name: "macOS Binary (Apple Silicon)"
url: "${PACKAGE_REGISTRY_URL}/seedctl-macos-aarch64"
- name: "Linux Binary (Raw)"
url: "${PACKAGE_REGISTRY_URL}/seedctl-linux-x86_64"
- name: "SHA256 Checksums"
url: "${PACKAGE_REGISTRY_URL}/SHA256SUMS"
- name: "GPG Signature"
url: "${PACKAGE_REGISTRY_URL}/SHA256SUMS.asc"