use TextArea model for service account key (#243) #50
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
goreleaser_and_TiUP: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
- name: Generate changelog | |
id: changelog | |
run: | | |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
gh api repos/$GITHUB_REPOSITORY/releases/generate-notes \ | |
-f tag_name="${GITHUB_REF#refs/tags/}" \ | |
-f target_commitish=main \ | |
-q .body > .CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
version: v2.1.0 | |
args: release ${{ contains(github.ref, 'nightly') && '--snapshot' || '--release-notes=.CHANGELOG.md' }} | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
GORELEASER_CURRENT_TAG: ${{steps.changelog.outputs.TAG_NAME}} | |
- name: Set up tiup | |
id: init_tiup | |
run: | | |
TMP_DIR=`mktemp -d` | |
export TIUP_HOME="$TMP_DIR/home" | |
echo "TIUP_HOME=$TIUP_HOME" >> $GITHUB_OUTPUT | |
echo "TIUP_BIN=$TIUP_HOME/bin/tiup" >> $GITHUB_OUTPUT | |
rm -rf $TIUP_HOME && mkdir -p $TIUP_HOME/{bin,keys} | |
wget -O $TMP_DIR/tiup-linux-amd64.tar.gz -q https://tiup-mirrors.pingcap.com/tiup-linux-amd64.tar.gz | |
tar -zxf $TMP_DIR/tiup-linux-amd64.tar.gz -C $TIUP_HOME/bin && chmod 755 $TIUP_HOME/bin/tiup | |
curl -s https://tiup-mirrors.pingcap.com/root.json -o $TIUP_HOME/bin/root.json | |
TIUP_MIRRORS=${{ secrets.TIUP_SERVER_PROD }} | |
$TIUP_HOME/bin/tiup mirror set ${TIUP_MIRRORS} | |
echo ${{ secrets.TIUP_COMP_KEY_PINGCAP }} | base64 -d > $TIUP_HOME/keys/private.json | |
- name: Publish package | |
env: | |
TIUP_HOME: ${{ steps.init_tiup.outputs.TIUP_HOME }} | |
TIUP_BIN: ${{ steps.init_tiup.outputs.TIUP_BIN }} | |
REL_VER: ${{steps.changelog.outputs.TAG_NAME}} | |
BINARY_NAME: "ticloud" | |
COMPONENT_NAME: "cloud" | |
COMPONENT_DESC: "CLI tool to manage TiDB Cloud" | |
run: | | |
matrix=( | |
'darwin amd64' | |
'darwin arm64' | |
'linux amd64' | |
'linux arm64' | |
) | |
# skip the first letter v in the tag name | |
export VER="${REL_VER:1}" | |
for item in "${matrix[@]}" ; do | |
os_arch=($item) | |
os=(${os_arch[0]}) | |
arch=(${os_arch[1]}) | |
filename="dist/${BINARY_NAME}_${VER}_${os}_${arch}.tar.gz" | |
if [ ! -f "$filename" ]; then | |
echo "File $filename does not exist" | |
exit 1 | |
fi | |
echo "Releasing ${REL_VER} for os $os arch $arch..." | |
${TIUP_BIN} mirror publish $COMPONENT_NAME ${REL_VER} $filename $BINARY_NAME --os=$os --arch=$arch --desc="$COMPONENT_DESC" | |
done | |
create-pr: | |
if: contains(github.ref, 'nightly') == false | |
runs-on: ubuntu-latest | |
needs: ["goreleaser_and_TiUP"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
- name: generate manifest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
go run cmd/manifest/update_latest_version.go | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
base: main | |
commit-message: "update latest version" | |
title: "update latest version" | |
body: "Update latest-version file and version in install.sh" | |
branch: "update-latest-version" |