Skip to content

fix: start etcd if not using memory as storage for Metasrv (#209) #3

fix: start etcd if not using memory as storage for Metasrv (#209)

fix: start etcd if not using memory as storage for Metasrv (#209) #3

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
release-install-script:
type: boolean
description: "Release install script to AWS-CN S3 bucket"
required: false
default: true
env:
GO_VERSION: "1.21"
MAX_UPLOAD_RETRY_TIMES: 20
UPLOAD_RETRY_TIMEOUT: 10 # minutes
jobs:
build:
name: build-binary
if: ${{ github.event_name == 'push' }}
strategy:
matrix:
# The file format is gtctl-<os>-<arch>
include:
- os: ubuntu-latest
file: gtctl-linux-amd64
goos: linux
goarch: amd64
- os: ubuntu-latest
file: gtctl-linux-arm64
goos: linux
goarch: arm64
- os: macos-latest
file: gtctl-darwin-arm64
goos: darwin
goarch: arm64
- os: macos-latest
file: gtctl-darwin-amd64
goos: darwin
goarch: amd64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build project
run: make
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
- name: Calculate checksum and rename binary
shell: bash
run: |
cd bin
chmod +x gtctl
tar -zcvf ${{ matrix.file }}.tgz gtctl
echo $(shasum -a 256 ${{ matrix.file }}.tgz | cut -f1 -d' ') > ${{ matrix.file }}.sha256sum
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.file }}
path: bin/${{ matrix.file }}.tgz
- name: Upload checksum of artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.file }}.sha256sum
path: bin/${{ matrix.file }}.sha256sum
- name: Upload artifacts to S3
uses: nick-invision/retry@v3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CN_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY}}
AWS_DEFAULT_REGION: ${{ vars.AWS_CN_RELEASE_BUCKET_REGION }}
with:
max_attempts: ${{ env.MAX_UPLOAD_RETRY_TIMES }}
timeout_minutes: ${{ env.UPLOAD_RETRY_TIMEOUT }}
command: |
aws s3 cp \
bin/${{ matrix.file }}.tgz \
s3://${{ vars.AWS_CN_RELEASE_BUCKET }}/releases/gtctl/${{ github.ref_name }}/${{ matrix.file }}.tgz && \
aws s3 cp \
bin/${{ matrix.file }}.sha256sum \
s3://${{ vars.AWS_CN_RELEASE_BUCKET }}/releases/gtctl/${{ github.ref_name }}/${{ matrix.file }}.sha256sum && \
aws s3 cp \
bin/${{ matrix.file }}.tgz \
s3://${{ vars.AWS_CN_RELEASE_BUCKET }}/releases/gtctl/latest/${{ matrix.file }}.tgz && \
aws s3 cp \
bin/${{ matrix.file }}.sha256sum \
s3://${{ vars.AWS_CN_RELEASE_BUCKET }}/releases/gtctl/latest/${{ matrix.file }}.sha256sum
release:
name: release-artifacts
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Publish release
uses: ncipollo/release-action@v1
with:
name: "Release ${{ github.ref_name }}"
prerelease: false
make_release: true
generateReleaseNotes: true
allowUpdates: true
tag: ${{ github.ref_name }}
artifacts: |
**/gtctl-*
release-install-script:
name: release-install-script
if: ${{ inputs.release-install-script }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Upload install.sh to S3
uses: nick-invision/retry@v4
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CN_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY}}
AWS_DEFAULT_REGION: ${{ vars.AWS_CN_RELEASE_BUCKET_REGION }}
with:
max_attempts: ${{ env.MAX_UPLOAD_RETRY_TIMES }}
timeout_minutes: ${{ env.UPLOAD_RETRY_TIMEOUT }}
command: |
aws s3 cp hack/install.sh s3://${{ vars.AWS_CN_RELEASE_BUCKET }}/releases/scripts/gtctl/install.sh