Merge pull request #1494 from trheyi/main
refactor(build): standardize artifact naming and streamline workflows
This commit is contained in:
commit
dab3404f7d
9 changed files with 111 additions and 220 deletions
2
.github/workflows/build-docker.yml
vendored
2
.github/workflows/build-docker.yml
vendored
|
|
@ -22,7 +22,7 @@ jobs:
|
|||
|
||||
- name: Get Version
|
||||
run: |
|
||||
echo VERSION=$(cat share/const.go |grep 'const VERSION' | awk '{print $4}' | sed "s/\"//g")-unstable >> $GITHUB_ENV
|
||||
echo VERSION=$(cat share/const.go |grep 'const VERSION' | awk '{print $4}' | sed "s/\"//g") >> $GITHUB_ENV
|
||||
|
||||
- name: Check Version
|
||||
run: echo $VERSION
|
||||
|
|
|
|||
40
.github/workflows/build-macos.yml
vendored
40
.github/workflows/build-macos.yml
vendored
|
|
@ -147,32 +147,32 @@ jobs:
|
|||
|
||||
- name: Sign Artifacts
|
||||
run: |
|
||||
codesign --deep --force --verbose --timestamp --sign "Developer ID Application: ${{ secrets.APPLE_SIGN }}" dist/release/yao-$VERSION-unstable-darwin-arm64
|
||||
codesign --deep --force --verbose --timestamp --sign "Developer ID Application: ${{ secrets.APPLE_SIGN }}" dist/release/yao-$VERSION-unstable-darwin-amd64
|
||||
codesign --deep --force --verbose --timestamp --sign "Developer ID Application: ${{ secrets.APPLE_SIGN }}" dist/release/yao-$VERSION-unstable-darwin-arm64-prod
|
||||
codesign --deep --force --verbose --timestamp --sign "Developer ID Application: ${{ secrets.APPLE_SIGN }}" dist/release/yao-$VERSION-unstable-darwin-amd64-prod
|
||||
codesign --deep --force --verbose --timestamp --sign "Developer ID Application: ${{ secrets.APPLE_SIGN }}" dist/release/yao-$VERSION-darwin-arm64
|
||||
codesign --deep --force --verbose --timestamp --sign "Developer ID Application: ${{ secrets.APPLE_SIGN }}" dist/release/yao-$VERSION-darwin-amd64
|
||||
codesign --deep --force --verbose --timestamp --sign "Developer ID Application: ${{ secrets.APPLE_SIGN }}" dist/release/yao-$VERSION-darwin-arm64-prod
|
||||
codesign --deep --force --verbose --timestamp --sign "Developer ID Application: ${{ secrets.APPLE_SIGN }}" dist/release/yao-$VERSION-darwin-amd64-prod
|
||||
|
||||
- name: Verify Signature
|
||||
run: |
|
||||
codesign --verify --deep --strict --verbose=2 dist/release/yao-$VERSION-unstable-darwin-arm64
|
||||
codesign --verify --deep --strict --verbose=2 dist/release/yao-$VERSION-unstable-darwin-amd64
|
||||
codesign --verify --deep --strict --verbose=2 dist/release/yao-$VERSION-unstable-darwin-arm64-prod
|
||||
codesign --verify --deep --strict --verbose=2 dist/release/yao-$VERSION-unstable-darwin-amd64-prod
|
||||
codesign --verify --deep --strict --verbose=2 dist/release/yao-$VERSION-darwin-arm64
|
||||
codesign --verify --deep --strict --verbose=2 dist/release/yao-$VERSION-darwin-amd64
|
||||
codesign --verify --deep --strict --verbose=2 dist/release/yao-$VERSION-darwin-arm64-prod
|
||||
codesign --verify --deep --strict --verbose=2 dist/release/yao-$VERSION-darwin-amd64-prod
|
||||
|
||||
- name: Send to Apple Notary Service
|
||||
run: |
|
||||
zip -r dist/release/yao-$VERSION-unstable-darwin-arm64.zip dist/release/yao-$VERSION-unstable-darwin-arm64
|
||||
zip -r dist/release/yao-$VERSION-unstable-darwin-amd64.zip dist/release/yao-$VERSION-unstable-darwin-amd64
|
||||
zip -r dist/release/yao-$VERSION-unstable-darwin-arm64-prod.zip dist/release/yao-$VERSION-unstable-darwin-arm64-prod
|
||||
zip -r dist/release/yao-$VERSION-unstable-darwin-amd64-prod.zip dist/release/yao-$VERSION-unstable-darwin-amd64-prod
|
||||
xcrun notarytool submit dist/release/yao-$VERSION-unstable-darwin-arm64.zip --apple-id "${{ secrets.APPLE_ID }}" --team-id "${{ secrets.APPLE_TEAME_ID }}" --password "${{ secrets.APPLE_APP_SPEC_PASS }}" --output-format json
|
||||
xcrun notarytool submit dist/release/yao-$VERSION-unstable-darwin-amd64.zip --apple-id "${{ secrets.APPLE_ID }}" --team-id "${{ secrets.APPLE_TEAME_ID }}" --password "${{ secrets.APPLE_APP_SPEC_PASS }}" --output-format json
|
||||
xcrun notarytool submit dist/release/yao-$VERSION-unstable-darwin-arm64-prod.zip --apple-id "${{ secrets.APPLE_ID }}" --team-id "${{ secrets.APPLE_TEAME_ID }}" --password "${{ secrets.APPLE_APP_SPEC_PASS }}" --output-format json
|
||||
xcrun notarytool submit dist/release/yao-$VERSION-unstable-darwin-amd64-prod.zip --apple-id "${{ secrets.APPLE_ID }}" --team-id "${{ secrets.APPLE_TEAME_ID }}" --password "${{ secrets.APPLE_APP_SPEC_PASS }}" --output-format json
|
||||
rm -f dist/release/yao-$VERSION-unstable-darwin-arm64.zip
|
||||
rm -f dist/release/yao-$VERSION-unstable-darwin-amd64.zip
|
||||
rm -f dist/release/yao-$VERSION-unstable-darwin-arm64-prod.zip
|
||||
rm -f dist/release/yao-$VERSION-unstable-darwin-amd64-prod.zip
|
||||
zip -r dist/release/yao-$VERSION-darwin-arm64.zip dist/release/yao-$VERSION-darwin-arm64
|
||||
zip -r dist/release/yao-$VERSION-darwin-amd64.zip dist/release/yao-$VERSION-darwin-amd64
|
||||
zip -r dist/release/yao-$VERSION-darwin-arm64-prod.zip dist/release/yao-$VERSION-darwin-arm64-prod
|
||||
zip -r dist/release/yao-$VERSION-darwin-amd64-prod.zip dist/release/yao-$VERSION-darwin-amd64-prod
|
||||
xcrun notarytool submit dist/release/yao-$VERSION-darwin-arm64.zip --apple-id "${{ secrets.APPLE_ID }}" --team-id "${{ secrets.APPLE_TEAME_ID }}" --password "${{ secrets.APPLE_APP_SPEC_PASS }}" --output-format json
|
||||
xcrun notarytool submit dist/release/yao-$VERSION-darwin-amd64.zip --apple-id "${{ secrets.APPLE_ID }}" --team-id "${{ secrets.APPLE_TEAME_ID }}" --password "${{ secrets.APPLE_APP_SPEC_PASS }}" --output-format json
|
||||
xcrun notarytool submit dist/release/yao-$VERSION-darwin-arm64-prod.zip --apple-id "${{ secrets.APPLE_ID }}" --team-id "${{ secrets.APPLE_TEAME_ID }}" --password "${{ secrets.APPLE_APP_SPEC_PASS }}" --output-format json
|
||||
xcrun notarytool submit dist/release/yao-$VERSION-darwin-amd64-prod.zip --apple-id "${{ secrets.APPLE_ID }}" --team-id "${{ secrets.APPLE_TEAME_ID }}" --password "${{ secrets.APPLE_APP_SPEC_PASS }}" --output-format json
|
||||
rm -f dist/release/yao-$VERSION-darwin-arm64.zip
|
||||
rm -f dist/release/yao-$VERSION-darwin-amd64.zip
|
||||
rm -f dist/release/yao-$VERSION-darwin-arm64-prod.zip
|
||||
rm -f dist/release/yao-$VERSION-darwin-amd64-prod.zip
|
||||
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
|
|
|
|||
82
.github/workflows/release-linux.yml
vendored
82
.github/workflows/release-linux.yml
vendored
|
|
@ -2,10 +2,6 @@ name: Release Linux
|
|||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Release version (e.g. 1.0.0 or 1.0.0-alpha). Leave empty to read from share/const.go."
|
||||
required: false
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
|
@ -58,7 +54,7 @@ jobs:
|
|||
path: /data/*
|
||||
|
||||
# ===================================================================
|
||||
# Docker Images (multi-platform linux/amd64 + linux/arm64)
|
||||
# Docker Images (multi-arch manifest: linux/amd64 + linux/arm64)
|
||||
# ===================================================================
|
||||
docker:
|
||||
needs: build
|
||||
|
|
@ -70,14 +66,8 @@ jobs:
|
|||
- name: Get Version
|
||||
id: version
|
||||
run: |
|
||||
if [ -n "${{ github.event.inputs.version }}" ]; then
|
||||
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
||||
elif [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
||||
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
VERSION=$(cat share/const.go | grep 'const VERSION' | awk '{print $4}' | sed 's/"//g')
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
VERSION=$(grep 'const VERSION =' share/const.go | awk '{print $4}' | sed 's/"//g')
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
|
@ -91,68 +81,26 @@ jobs:
|
|||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: Build & Push Development (amd64)
|
||||
- name: Build & Push Development (multi-arch)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker/development
|
||||
platforms: linux/amd64
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}-unstable
|
||||
ARCH=amd64
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
push: true
|
||||
tags: ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}-amd64-dev
|
||||
tags: |
|
||||
${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}-dev
|
||||
${{ env.IMAGE_NAME }}:dev
|
||||
|
||||
- name: Build & Push Development (arm64)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker/development
|
||||
platforms: linux/arm64
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}-unstable
|
||||
ARCH=arm64
|
||||
push: true
|
||||
tags: ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}-arm64-dev
|
||||
|
||||
- name: Build & Push Production (amd64)
|
||||
- name: Build & Push Production (multi-arch)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker/production
|
||||
platforms: linux/amd64
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}-unstable
|
||||
ARCH=amd64
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
push: true
|
||||
tags: ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}-amd64
|
||||
|
||||
- name: Build & Push Production (arm64)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker/production
|
||||
platforms: linux/arm64
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}-unstable
|
||||
ARCH=arm64
|
||||
push: true
|
||||
tags: ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}-arm64
|
||||
|
||||
- name: Build & Push Slim (amd64)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker/production-slim
|
||||
platforms: linux/amd64
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}-unstable
|
||||
ARCH=amd64
|
||||
push: true
|
||||
tags: ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}-amd64-slim
|
||||
|
||||
- name: Build & Push Slim (arm64)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker/production-slim
|
||||
platforms: linux/arm64
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}-unstable
|
||||
ARCH=arm64
|
||||
push: true
|
||||
tags: ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}-arm64-slim
|
||||
tags: |
|
||||
${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
||||
${{ env.IMAGE_NAME }}:latest
|
||||
|
|
|
|||
75
.github/workflows/release-macos.yml
vendored
75
.github/workflows/release-macos.yml
vendored
|
|
@ -2,10 +2,6 @@ name: Release macOS
|
|||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Release version (e.g. 1.0.0 or 1.0.0-alpha). Leave empty to read from share/const.go."
|
||||
required: false
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
|
@ -105,22 +101,14 @@ jobs:
|
|||
- name: Setup Go Tools
|
||||
run: make tools
|
||||
|
||||
- name: Make Artifacts macOS
|
||||
run: make artifacts-macos
|
||||
|
||||
- name: Get Version
|
||||
id: version
|
||||
run: |
|
||||
if [ -n "${{ github.event.inputs.version }}" ]; then
|
||||
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
||||
elif [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
||||
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
VERSION=$(cat share/const.go | grep 'const VERSION' | awk '{print $4}' | sed 's/"//g')
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Make Artifacts macOS
|
||||
run: make artifacts-macos
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
VERSION=$(grep 'const VERSION =' share/const.go | awk '{print $4}' | sed 's/"//g')
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: List Build Output
|
||||
run: ls -lh dist/release/
|
||||
|
|
@ -154,45 +142,64 @@ jobs:
|
|||
VERSION="${{ steps.version.outputs.version }}"
|
||||
IDENTITY="Developer ID Application: ${{ secrets.APPLE_SIGN }}"
|
||||
for ARCH in arm64 amd64; do
|
||||
BIN="dist/release/yao-${VERSION}-unstable-darwin-${ARCH}"
|
||||
codesign --force --verbose --timestamp --options runtime --sign "$IDENTITY" "$BIN"
|
||||
codesign --verify --deep --strict --verbose=2 "$BIN"
|
||||
for SUFFIX in "" "-prod"; do
|
||||
BIN="dist/release/yao-${VERSION}-darwin-${ARCH}${SUFFIX}"
|
||||
codesign --force --verbose --timestamp --options runtime --sign "$IDENTITY" "$BIN"
|
||||
codesign --verify --deep --strict --verbose=2 "$BIN"
|
||||
done
|
||||
done
|
||||
|
||||
- name: Prepare Output and Checksums
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
for ARCH in arm64 amd64; do
|
||||
mkdir -p /tmp/yao-output-${ARCH}
|
||||
cp "dist/release/yao-${VERSION}-unstable-darwin-${ARCH}" "/tmp/yao-output-${ARCH}/yao"
|
||||
chmod +x "/tmp/yao-output-${ARCH}/yao"
|
||||
for VARIANT in dev prod; do
|
||||
if [ "$VARIANT" = "dev" ]; then
|
||||
SRC="dist/release/yao-${VERSION}-darwin-${ARCH}"
|
||||
else
|
||||
SRC="dist/release/yao-${VERSION}-darwin-${ARCH}-prod"
|
||||
fi
|
||||
DIR="/tmp/yao-output-${ARCH}-${VARIANT}"
|
||||
mkdir -p "$DIR"
|
||||
cp "$SRC" "$DIR/yao"
|
||||
chmod +x "$DIR/yao"
|
||||
done
|
||||
done
|
||||
|
||||
mkdir -p /tmp/checksums
|
||||
shasum -a 256 /tmp/yao-output-arm64/yao | awk '{print $1" yao"}' > /tmp/checksums/yao-darwin-arm64.sha256
|
||||
shasum -a 256 /tmp/yao-output-amd64/yao | awk '{print $1" yao"}' > /tmp/checksums/yao-darwin-amd64.sha256
|
||||
for ARCH in arm64 amd64; do
|
||||
for VARIANT in dev prod; do
|
||||
shasum -a 256 "/tmp/yao-output-${ARCH}-${VARIANT}/yao" | awk '{print $1" yao"}' > "/tmp/checksums/yao-darwin-${ARCH}-${VARIANT}.sha256"
|
||||
done
|
||||
done
|
||||
cat /tmp/checksums/*.sha256
|
||||
|
||||
- name: Upload arm64 Binary
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: yao-darwin-arm64
|
||||
path: /tmp/yao-output-arm64/yao
|
||||
path: /tmp/yao-output-arm64-prod/yao
|
||||
|
||||
- name: Upload arm64 Dev Binary
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: yao-darwin-arm64-dev
|
||||
path: /tmp/yao-output-arm64-dev/yao
|
||||
|
||||
- name: Upload amd64 Binary
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: yao-darwin-amd64
|
||||
path: /tmp/yao-output-amd64/yao
|
||||
path: /tmp/yao-output-amd64-prod/yao
|
||||
|
||||
- name: Upload arm64 Checksum
|
||||
- name: Upload amd64 Dev Binary
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: yao-darwin-arm64-sha256
|
||||
path: /tmp/checksums/yao-darwin-arm64.sha256
|
||||
name: yao-darwin-amd64-dev
|
||||
path: /tmp/yao-output-amd64-dev/yao
|
||||
|
||||
- name: Upload amd64 Checksum
|
||||
- name: Upload Checksums
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: yao-darwin-amd64-sha256
|
||||
path: /tmp/checksums/yao-darwin-amd64.sha256
|
||||
name: yao-darwin-checksums
|
||||
path: /tmp/checksums/*.sha256
|
||||
|
|
|
|||
29
.github/workflows/release.yml
vendored
29
.github/workflows/release.yml
vendored
|
|
@ -26,7 +26,8 @@ jobs:
|
|||
id: version
|
||||
run: |
|
||||
TAG="${{ github.event.workflow_run.head_branch }}"
|
||||
echo "version=${TAG#v}" >> $GITHUB_OUTPUT
|
||||
VERSION=$(grep 'const VERSION =' share/const.go | awk '{print $4}' | sed 's/"//g')
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Wait for Both Workflows
|
||||
|
|
@ -74,28 +75,30 @@ jobs:
|
|||
TAG="${{ steps.version.outputs.tag }}"
|
||||
MACOS_RUN_ID=$(gh run list --workflow="Release macOS" --branch="$TAG" --limit=1 --json databaseId --jq '.[0].databaseId')
|
||||
mkdir -p dist/macos
|
||||
gh run download "$MACOS_RUN_ID" --name yao-darwin-arm64 --dir dist/macos
|
||||
gh run download "$MACOS_RUN_ID" --name yao-darwin-amd64 --dir dist/macos
|
||||
gh run download "$MACOS_RUN_ID" --pattern "yao-darwin-*-sha256" --dir dist/macos
|
||||
gh run download "$MACOS_RUN_ID" --name yao-darwin-arm64 --dir dist/macos/arm64-prod
|
||||
gh run download "$MACOS_RUN_ID" --name yao-darwin-arm64-dev --dir dist/macos/arm64-dev
|
||||
gh run download "$MACOS_RUN_ID" --name yao-darwin-amd64 --dir dist/macos/amd64-prod
|
||||
gh run download "$MACOS_RUN_ID" --name yao-darwin-amd64-dev --dir dist/macos/amd64-dev
|
||||
gh run download "$MACOS_RUN_ID" --name yao-darwin-checksums --dir dist/macos/checksums
|
||||
|
||||
- name: Prepare Release Files
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
mkdir -p release
|
||||
|
||||
# Linux artifacts (already named correctly from build.sh)
|
||||
cp dist/linux/* release/ 2>/dev/null || true
|
||||
|
||||
if [ -f dist/macos/yao-darwin-arm64/yao ]; then
|
||||
cp dist/macos/yao-darwin-arm64/yao "release/yao-${VERSION}-darwin-arm64"
|
||||
elif [ -f dist/macos/yao ]; then
|
||||
cp dist/macos/yao "release/yao-${VERSION}-darwin-arm64"
|
||||
fi
|
||||
# macOS prod binaries
|
||||
cp dist/macos/arm64-prod/yao "release/yao-${VERSION}-darwin-arm64"
|
||||
cp dist/macos/amd64-prod/yao "release/yao-${VERSION}-darwin-amd64"
|
||||
|
||||
if [ -f dist/macos/yao-darwin-amd64/yao ]; then
|
||||
cp dist/macos/yao-darwin-amd64/yao "release/yao-${VERSION}-darwin-amd64"
|
||||
fi
|
||||
# macOS dev binaries
|
||||
cp dist/macos/arm64-dev/yao "release/yao-${VERSION}-darwin-arm64-dev"
|
||||
cp dist/macos/amd64-dev/yao "release/yao-${VERSION}-darwin-amd64-dev"
|
||||
|
||||
find dist/macos -name "*.sha256" -exec cp {} release/ \;
|
||||
# Checksums
|
||||
cp dist/macos/checksums/*.sha256 release/ 2>/dev/null || true
|
||||
|
||||
chmod +x release/yao-* 2>/dev/null || true
|
||||
echo "=== Release files ==="
|
||||
|
|
|
|||
34
Makefile
34
Makefile
|
|
@ -565,33 +565,19 @@ artifacts-linux: clean
|
|||
|
||||
# Making artifacts - dev builds (full debug symbols, ~158M)
|
||||
mkdir -p dist
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" GOOS=linux GOARCH=amd64 go build -v -o dist/yao-${VERSION}-unstable-linux-amd64
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" LD_LIBRARY_PATH=/usr/lib/gcc-cross/aarch64-linux-gnu/13 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc-13 CXX=aarch64-linux-gnu-g++-13 go build -v -o dist/yao-${VERSION}-unstable-linux-arm64
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" GOOS=linux GOARCH=amd64 go build -v -o dist/yao-${VERSION}-linux-amd64
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" LD_LIBRARY_PATH=/usr/lib/gcc-cross/aarch64-linux-gnu/13 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc-13 CXX=aarch64-linux-gnu-g++-13 go build -v -o dist/yao-${VERSION}-linux-arm64
|
||||
|
||||
# Making artifacts - prod builds (stripped, ~111M)
|
||||
sed -i.tmp 's/const BUILDOPTIONS = ""/const BUILDOPTIONS = "-s -w (production, stripped)"/g' share/const.go && rm -f share/const.go.tmp
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" GOOS=linux GOARCH=amd64 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-unstable-linux-amd64-prod
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" LD_LIBRARY_PATH=/usr/lib/gcc-cross/aarch64-linux-gnu/13 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc-13 CXX=aarch64-linux-gnu-g++-13 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-unstable-linux-arm64-prod
|
||||
|
||||
# Making artifacts - prod-upx builds (stripped + compressed, ~45-55M)
|
||||
sed -i.tmp 's/const BUILDOPTIONS = "-s -w (production, stripped)"/const BUILDOPTIONS = "-s -w +upx (production, compressed)"/g' share/const.go && rm -f share/const.go.tmp
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" GOOS=linux GOARCH=amd64 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-unstable-linux-amd64-prod-upx
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" LD_LIBRARY_PATH=/usr/lib/gcc-cross/aarch64-linux-gnu/13 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc-13 CXX=aarch64-linux-gnu-g++-13 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-unstable-linux-arm64-prod-upx
|
||||
|
||||
# UPX compression for prod-upx builds
|
||||
@if command -v upx > /dev/null 2>&1; then \
|
||||
echo "Compressing with UPX..."; \
|
||||
upx --best dist/yao-${VERSION}-unstable-linux-amd64-prod-upx; \
|
||||
upx --best dist/yao-${VERSION}-unstable-linux-arm64-prod-upx; \
|
||||
else \
|
||||
echo "WARNING: UPX not found, skipping compression"; \
|
||||
fi
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" GOOS=linux GOARCH=amd64 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-linux-amd64-prod
|
||||
CGO_ENABLED=1 CGO_LDFLAGS="-static" LD_LIBRARY_PATH=/usr/lib/gcc-cross/aarch64-linux-gnu/13 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc-13 CXX=aarch64-linux-gnu-g++-13 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-linux-arm64-prod
|
||||
|
||||
mkdir -p dist/release
|
||||
mv dist/yao-*-* dist/release/
|
||||
chmod +x dist/release/yao-*-*
|
||||
ls -l dist/release/
|
||||
dist/release/yao-${VERSION}-unstable-linux-amd64 version
|
||||
dist/release/yao-${VERSION}-linux-amd64 version
|
||||
|
||||
# Reset const
|
||||
# cp -f share/const.goe share/const.go
|
||||
|
|
@ -639,19 +625,19 @@ artifacts-macos: clean
|
|||
|
||||
# Making artifacts - dev builds (full debug symbols)
|
||||
mkdir -p dist
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -o dist/yao-${VERSION}-unstable-darwin-amd64
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -v -o dist/yao-${VERSION}-unstable-darwin-arm64
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -o dist/yao-${VERSION}-darwin-amd64
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -v -o dist/yao-${VERSION}-darwin-arm64
|
||||
|
||||
# Making artifacts - prod builds (stripped, no UPX on macOS)
|
||||
sed -i.tmp 's/const BUILDOPTIONS = ""/const BUILDOPTIONS = "-s -w (production, stripped)"/g' share/const.go && rm -f share/const.go.tmp
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-unstable-darwin-amd64-prod
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-unstable-darwin-arm64-prod
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-darwin-amd64-prod
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -v -ldflags="-s -w" -o dist/yao-${VERSION}-darwin-arm64-prod
|
||||
|
||||
mkdir -p dist/release
|
||||
mv dist/yao-*-* dist/release/
|
||||
chmod +x dist/release/yao-*-*
|
||||
ls -l dist/release/
|
||||
dist/release/yao-${VERSION}-unstable-darwin-amd64 version
|
||||
dist/release/yao-${VERSION}-darwin-amd64 version
|
||||
|
||||
|
||||
.PHONY: debug
|
||||
|
|
|
|||
|
|
@ -1,26 +1,15 @@
|
|||
# ===========================================
|
||||
# Yao Development
|
||||
# docker build \
|
||||
# --build-arg VERSION="${VERSION}" \
|
||||
# --build-arg ARCH="${ARCH}" \
|
||||
# -t yaoapp/yao-dev:${VERSION}-${ARCH} .
|
||||
#
|
||||
# Build:
|
||||
# docker build --platform linux/amd64 --build-arg VERSION=1.0.0 --build-arg ARCH=amd64 -t yaoapp/yao:1.0.0-amd64-dev .
|
||||
# docker build --platform linux/arm64 --build-arg VERSION=1.0.0 --build-arg ARCH=arm64 -t yaoapp/yao:1.0.0-arm64-dev .
|
||||
#
|
||||
# Tests:
|
||||
# docker run --rm yaoapp/yao:1.0.0-amd64-dev yao version
|
||||
# docker run -d -p 5099:5099 yaoapp/yao:1.0.0-amd64-dev
|
||||
#
|
||||
# docker build --build-arg VERSION="1.0.0-alpha" -t yaoapp/yao:1.0.0-alpha-dev .
|
||||
# docker run --rm yaoapp/yao:1.0.0-alpha-dev yao version
|
||||
# ===========================================
|
||||
FROM ubuntu:24.04
|
||||
ARG VERSION
|
||||
ARG ARCH
|
||||
ARG TARGETARCH
|
||||
RUN groupadd -r yao && useradd -r -g yao yao && \
|
||||
apt-get update && \
|
||||
apt-get install -y curl sudo procps net-tools
|
||||
RUN curl -fsSL "https://pub-80136338e60643edbb55c6ca8a689cf8.r2.dev/archives/yao-${VERSION}-linux-${ARCH}" > /usr/local/bin/yao && \
|
||||
RUN curl -fsSL "https://pub-80136338e60643edbb55c6ca8a689cf8.r2.dev/archives/yao-${VERSION}-linux-${TARGETARCH}" > /usr/local/bin/yao && \
|
||||
chmod +x /usr/local/bin/yao && \
|
||||
mkdir -p /data/app
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
# ===========================================
|
||||
# Yao Production Slim (UPX compressed)
|
||||
# docker build \
|
||||
# --build-arg VERSION="${VERSION}" \
|
||||
# --build-arg ARCH="${ARCH}" \
|
||||
# -t yaoapp/yao:${VERSION}-${ARCH}-slim .
|
||||
#
|
||||
# Build:
|
||||
# docker build --platform linux/amd64 --build-arg VERSION=1.0.0 --build-arg ARCH=amd64 -t yaoapp/yao:1.0.0-amd64-slim .
|
||||
# docker build --platform linux/arm64 --build-arg VERSION=1.0.0 --build-arg ARCH=arm64 -t yaoapp/yao:1.0.0-arm64-slim .
|
||||
#
|
||||
# Tests:
|
||||
# docker run --rm yaoapp/yao:1.0.0-amd64-slim yao version
|
||||
# docker run -d -p 5099:5099 yaoapp/yao:1.0.0-amd64-slim
|
||||
#
|
||||
# ===========================================
|
||||
FROM alpine:latest
|
||||
ARG VERSION
|
||||
ARG ARCH
|
||||
RUN apk --no-cache add curl
|
||||
RUN curl -fsSL "https://pub-80136338e60643edbb55c6ca8a689cf8.r2.dev/archives/yao-${VERSION}-linux-${ARCH}-prod-upx" > /usr/local/bin/yao && \
|
||||
chmod +x /usr/local/bin/yao && \
|
||||
addgroup -S yao && adduser -S -G yao yao && \
|
||||
mkdir -p /data/app && \
|
||||
chown -R yao:yao /data/app
|
||||
|
||||
USER yao
|
||||
VOLUME /data/app
|
||||
WORKDIR /data/app
|
||||
EXPOSE 5099
|
||||
CMD ["/usr/local/bin/yao", "start"]
|
||||
|
|
@ -1,24 +1,13 @@
|
|||
# ===========================================
|
||||
# Yao Production
|
||||
# docker build \
|
||||
# --build-arg VERSION="${VERSION}" \
|
||||
# --build-arg ARCH="${ARCH}" \
|
||||
# -t yaoapp/yao:${VERSION}-${ARCH} .
|
||||
#
|
||||
# Build:
|
||||
# docker build --platform linux/amd64 --build-arg VERSION=1.0.0 --build-arg ARCH=amd64 -t yaoapp/yao:1.0.0-amd64 .
|
||||
# docker build --platform linux/arm64 --build-arg VERSION=1.0.0 --build-arg ARCH=arm64 -t yaoapp/yao:1.0.0-arm64 .
|
||||
#
|
||||
# Tests:
|
||||
# docker run --rm yaoapp/yao:1.0.0-amd64 yao version
|
||||
# docker run -d -p 5099:5099 yaoapp/yao:1.0.0-amd64
|
||||
#
|
||||
# docker build --build-arg VERSION="1.0.0-alpha" -t yaoapp/yao:1.0.0-alpha .
|
||||
# docker run --rm yaoapp/yao:1.0.0-alpha yao version
|
||||
# ===========================================
|
||||
FROM alpine:latest
|
||||
ARG VERSION
|
||||
ARG ARCH
|
||||
ARG TARGETARCH
|
||||
RUN apk --no-cache add curl
|
||||
RUN curl -fsSL "https://pub-80136338e60643edbb55c6ca8a689cf8.r2.dev/archives/yao-${VERSION}-linux-${ARCH}-prod" > /usr/local/bin/yao && \
|
||||
RUN curl -fsSL "https://pub-80136338e60643edbb55c6ca8a689cf8.r2.dev/archives/yao-${VERSION}-linux-${TARGETARCH}-prod" > /usr/local/bin/yao && \
|
||||
chmod +x /usr/local/bin/yao && \
|
||||
addgroup -S yao && adduser -S -G yao yao && \
|
||||
mkdir -p /data/app && \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue