github.com/yaling888/clash@v1.53.0/.github/workflows/release.yml (about) 1 name: Release 2 on: [push] 3 jobs: 4 build: 5 runs-on: ubuntu-latest 6 steps: 7 - name: Check out code into the Go module directory 8 uses: actions/checkout@v4 9 10 - name: Get latest go version 11 id: version 12 run: | 13 go_mod_version=$(cat go.mod | grep -oE '^go [0-9]{1,}.[0-9|a-z]{1,}(.[0-9]{1,})?' | awk '(NR==1){printf $2}') 14 latest_go_version=$(curl -sSL https://go.dev/dl/?mode=json | grep "version" | cut -d\" -f4 | awk -Fgo '(NR==1){printf $2}') || "" 15 go_version="$latest_go_version" 16 17 if [[ -z "$latest_go_version" ]] || [[ $go_mod_version =~ .*[rc|beta].* ]]; then 18 go_version="$go_mod_version" 19 fi 20 21 echo "go_version=${go_version}" >> $GITHUB_OUTPUT 22 23 - name: Setup Go 24 uses: actions/setup-go@v5 25 with: 26 go-version: ${{ steps.version.outputs.go_version }} 27 check-latest: true 28 cache: false 29 30 - name: Go cache paths 31 id: go-cache-paths 32 run: | 33 echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT 34 echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT 35 36 - name: Cache go module 37 uses: actions/cache@v4 38 with: 39 path: | 40 ${{ steps.go-cache-paths.outputs.go-mod }} 41 ${{ steps.go-cache-paths.outputs.go-build }} 42 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 43 restore-keys: | 44 ${{ runner.os }}-go- 45 46 - name: Get dependencies, run test 47 run: | 48 go test ./... 49 50 - name: Build 51 if: startsWith(github.ref, 'refs/tags/') 52 env: 53 NAME: clash-plus-pro 54 BINDIR: bin 55 run: make -j $(go run ./test/main.go) releases 56 57 #- name: Prepare upload 58 # run: | 59 # echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV 60 # echo "FILE_SHA=$(git describe --tags --always 2>/dev/null)" >> $GITHUB_ENV 61 # 62 #- name: Upload files to Artifacts 63 # uses: actions/upload-artifact@v2 64 # if: startsWith(github.ref, 'refs/tags/') == false 65 # with: 66 # name: clash_${{ env.FILE_SHA }}${{ env.FILE_DATE }} 67 # path: | 68 # bin/* 69 70 - name: Upload Release 71 uses: softprops/action-gh-release@v2 72 if: startsWith(github.ref, 'refs/tags/') 73 with: 74 files: bin/* 75 draft: false 76 prerelease: false 77 generate_release_notes: true 78 79 #- name: Delete workflow runs 80 # uses: GitRML/delete-workflow-runs@main 81 # with: 82 # retain_days: 1 83 # keep_minimum_runs: 2