Olares/.github/workflows/release-cli.yaml

83 lines
2.2 KiB
YAML

name: Release CLI
on:
workflow_call:
inputs:
version:
type: string
required: true
ref:
type: string
repository:
type: string
release-id:
type: string
workflow_dispatch:
inputs:
version:
type: string
required: true
ref:
type: string
repository:
type: string
release-id:
type: string
jobs:
goreleaser:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
ref: ${{ inputs.ref }}
repository: ${{ inputs.repository }}
- name: Add Local Git Tag For GoReleaser
run: git tag ${{ inputs.version }}
continue-on-error: true
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.24.11
- name: Install x86_64 cross-compiler
run: sudo apt-get update && sudo apt-get install -y build-essential
- name: Install ARM cross-compiler
run: sudo apt-get update && sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3.1.0
with:
distribution: goreleaser
workdir: './cli'
version: v1.18.2
args: release --clean
env:
OLARES_RELEASE_ID: ${{ inputs.release-id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install coscmd
run: pip install coscmd
- name: Configure coscmd
env:
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }}
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }}
COS_BUCKET: ${{ secrets.COS_BUCKET }}
COS_REGION: ${{ secrets.COS_REGION }}
END_POINT: ${{ secrets.END_POINT }}
run: |
coscmd config -a $TENCENT_SECRET_ID \
-s $TENCENT_SECRET_KEY \
-b $COS_BUCKET \
-r $COS_REGION
- name: Upload to S3
run: |
cd cli/output && for file in $(ls *.tar.gz | grep -v no-release-id); do
coscmd upload cp "$file" ${{ secrets.REPO_PATH }}${file} --acl=public-read
done