Skip to content

chore: release v0.0.61 #1

chore: release v0.0.61

chore: release v0.0.61 #1

Workflow file for this run

name: Build and Publish Docker Image
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: Docker image tag to publish
required: true
type: string
env:
BUN_VERSION: 1.3.14
GHCR_IMAGE: ghcr.io/hackycy/hackycy-cli
TENCENT_IMAGE: ccr.ccs.tencentyun.com/soosin/hackycy-cli
PLATFORMS: linux/amd64,linux/arm64
jobs:
build:
strategy:
matrix:
include:
- target: linux-x64
artifact: ycy-linux-x64
- target: linux-arm64
artifact: ycy-linux-arm64
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build binary
run: |
bun scripts/build.ts \
--target bun-${{ matrix.target }} \
--outfile ${{ matrix.artifact }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Linux build artifacts
uses: actions/download-artifact@v4
with:
pattern: ycy-linux-*
path: docker-artifacts
- name: Resolve image tags
id: image
env:
EVENT_NAME: ${{ github.event_name }}
MANUAL_TAG: ${{ inputs.tag }}
REF_TAG: ${{ github.ref_name }}
GHCR_IMAGE: ${{ env.GHCR_IMAGE }}
TENCENT_IMAGE: ${{ env.TENCENT_IMAGE }}
run: |
if [ "$EVENT_NAME" = 'workflow_dispatch' ]; then
tag="$MANUAL_TAG"
else
tag="$REF_TAG"
fi
{
echo 'tags<<EOF'
echo "$GHCR_IMAGE:$tag"
echo "$TENCENT_IMAGE:$tag"
if [ "$EVENT_NAME" = 'push' ]; then
echo "$GHCR_IMAGE:latest"
echo "$TENCENT_IMAGE:latest"
fi
echo 'EOF'
} >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Tencent Cloud Container Registry
uses: docker/login-action@v3
with:
registry: ccr.ccs.tencentyun.com
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
- name: Build and publish image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ steps.image.outputs.tags }}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: |
type=gha,scope=ghcr-hackycy-cli
type=gha,scope=tencent-hackycy-cli
cache-to: |
type=gha,mode=max,scope=ghcr-hackycy-cli
type=gha,mode=max,scope=tencent-hackycy-cli