- Updated Makefile to remove "unstable" suffix from artifact names for both Linux and macOS builds, enhancing consistency. - Simplified version retrieval in GitHub workflows, ensuring a more straightforward approach to version management. - Consolidated Docker build steps to support multi-architecture builds, improving efficiency and clarity in the release process. - Removed deprecated production-slim Dockerfile, streamlining the Docker setup. Made-with: Cursor
106 lines
3.2 KiB
YAML
106 lines
3.2 KiB
YAML
name: Release Linux
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
IMAGE_NAME: yaoapp/yao
|
|
|
|
jobs:
|
|
# ===================================================================
|
|
# Build Linux Binaries (amd64 + arm64)
|
|
# ===================================================================
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: yaoapp/yao-build:1.0.0
|
|
env:
|
|
CF_ACCESS_KEY_ID: ${{ secrets.CF_ACCESS_KEY_ID }}
|
|
CF_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }}
|
|
R2_BUCKET: ${{ secrets.R2_BUCKET }}
|
|
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
|
|
steps:
|
|
- name: Configure R2 For Cloudflare
|
|
run: |
|
|
aws configure set aws_access_key_id $CF_ACCESS_KEY_ID
|
|
aws configure set aws_secret_access_key $CF_SECRET_ACCESS_KEY
|
|
aws configure set default.region us-east-1
|
|
aws configure set default.s3.signature_version s3v4
|
|
aws configure set default.s3.endpoint_url https://$R2_ACCOUNT_ID.r2.cloudflarestorage.com
|
|
|
|
- name: Build
|
|
run: |
|
|
export PATH=$PATH:/github/home/go/bin
|
|
/app/build.sh
|
|
ls -l /data
|
|
|
|
- name: Push To R2
|
|
run: |
|
|
for file in /data/*; do
|
|
aws s3 cp "$file" s3://$R2_BUCKET/archives/ \
|
|
--endpoint-url https://$R2_ACCOUNT_ID.r2.cloudflarestorage.com
|
|
done
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: yao-linux
|
|
path: /data/*
|
|
|
|
# ===================================================================
|
|
# Docker Images (multi-arch manifest: linux/amd64 + linux/arm64)
|
|
# ===================================================================
|
|
docker:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get Version
|
|
id: version
|
|
run: |
|
|
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
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Build & Push Development (multi-arch)
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./docker/development
|
|
platforms: linux/amd64,linux/arm64
|
|
build-args: |
|
|
VERSION=${{ steps.version.outputs.version }}
|
|
push: true
|
|
tags: |
|
|
${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}-dev
|
|
${{ env.IMAGE_NAME }}:dev
|
|
|
|
- name: Build & Push Production (multi-arch)
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./docker/production
|
|
platforms: linux/amd64,linux/arm64
|
|
build-args: |
|
|
VERSION=${{ steps.version.outputs.version }}
|
|
push: true
|
|
tags: |
|
|
${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
|
${{ env.IMAGE_NAME }}:latest
|