This repository has been archived by the owner on Apr 30, 2024. It is now read-only.
TPClash Release #26
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: TPClash Release | |
on: | |
workflow_dispatch: | |
inputs: | |
trigger: | |
description: Manually trigger | |
required: true | |
type: choice | |
options: | |
- release | |
env: | |
FORCE_COLOR: 1 | |
CGO_ENABLED: 0 | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Put back the git branch into git | |
shell: bash | |
run: | | |
branch="" | |
if [ -n "$GITHUB_HEAD_REF" ]; then | |
branch="$GITHUB_HEAD_REF" | |
else | |
branch="${GITHUB_REF##*/}" | |
fi | |
git checkout -b "$branch" || true | |
- name: Docker Login | |
shell: bash | |
run: docker login --username "${DOCKERHUB_USERNAME}" --password "${DOCKERHUB_PASSWORD}" | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- name: Use Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 'stable' | |
- name: Install Deps | |
shell: bash | |
run: | | |
npm install -g pnpm @go-task/cli | |
- name: Build TPClash | |
id: build | |
shell: bash | |
run: | | |
task | |
echo "status=success" >> $GITHUB_OUTPUT | |
- name: Get current date | |
id: timestamp | |
run: | | |
export TZ='Asia/Shanghai' | |
echo "date=$(date '+%Y-%m-%d-%H-%M-%S')" >> $GITHUB_OUTPUT | |
- name: Extract Tag Name | |
id: extract_tag | |
run: | | |
echo "tag_name=$(echo $GITHUB_REF | awk -F/ '{print $3}')" >> $GITHUB_OUTPUT | |
echo "status=success" >> $GITHUB_OUTPUT | |
- name: Generate release info | |
id: info | |
if: steps.build.outputs.status == 'success' | |
run: | | |
echo "${{ steps.extract_tag.outputs.tag_name }}" >> release.txt | |
echo "" >> release.txt | |
echo "${{ secrets.RELEASE_INFO }}" >> release.txt | |
echo "" >> release.txt | |
echo "Build time: ${{ steps.timestamp.outputs.date }}" >> release.txt | |
echo "Telegram: https://t.me/tpclash" >> release.txt | |
touch release.txt | |
echo "status=success" >> $GITHUB_OUTPUT | |
- name: Upload artifacts to release | |
uses: softprops/action-gh-release@v1 | |
if: steps.info.outputs.status == 'success' | |
env: | |
GITHUB_TOKEN: ${{ secrets.G1THUB_TOKEN }} | |
with: | |
prerelease: ${{ secrets.PRERELEASE }} | |
tag_name: ${{ steps.extract_tag.outputs.tag_name }} | |
body_path: release.txt | |
files: build/* |