fix not login to gh

This commit is contained in:
name 2022-02-04 00:29:37 +08:00
parent f9f9f84f7f
commit de234b3d8c
2 changed files with 19 additions and 7 deletions

View File

@ -15,9 +15,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Config git
# run: git config --global user.email "name@gmail.com"&&git config --global user.name "name"
- name: Check new version and push
run: bash -x ./scripts/destVersionRelease.sh ${{ github.event.inputs.download_link }}
- name: Test Github Action Server Time
run: bash -x echo `date`
run: bash -x echo `date`
- name: Check new version and push
env:
GHTOKEN: ${{ secrets.GHTOKEN }}
run: bash -x ./scripts/destVersionRelease.sh ${{ github.event.inputs.download_link }}

View File

@ -11,7 +11,7 @@ if [ -z "$1" ]; then
download_link="https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe"
fi
function install_depends () {
function install_depends() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mInstalling 7zip, shasum, wget, curl, git\033[0m"
@ -20,6 +20,16 @@ function install_depends () {
apt install -y p7zip-full p7zip-rar libdigest-sha-perl wget curl git
}
function login_gh() {
echo $GHTOKEN > WeChatSetup/temp/GHTOKEN
gh auth login --with-token < WeChatSetup/temp/GHTOKEN
if [ "$?" -ne 0 ]; then
>&2 echo -e "\033[1;31mLogin Failed, please check your network or token!\033[0m"
clean_data 1
fi
rm -rfv WeChatSetup/temp/GHTOKEN
}
function download_wechat() {
printf "#%.0s" {1..60}
echo
@ -74,8 +84,9 @@ function clean_data() {
}
function main() {
rm -rfv WeChatSetup/*
# rm -rfv WeChatSetup/*
mkdir -p ${temp_path}/temp
login_gh
## https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
# install_depends
download_wechat
@ -92,6 +103,7 @@ function main() {
prepare_commit
gh release create v$dest_version ./WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe -F ./WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256 -t "Wechat v$dest_version"
gh auth logout
clean_data 0
}