From d24904ece895897710ffebf9f14725c495cb99f3 Mon Sep 17 00:00:00 2001 From: YiFang Xiao Date: Mon, 14 Mar 2022 20:20:14 +0800 Subject: [PATCH] github:add 6.2 support seperate autotag into an alone workflow. other os's workflow dependent on it --- .github/workflows/macos copy.yml | 3 +- .github/workflows/macos-6.2.yml | 11 +++--- .github/workflows/macos.yml | 54 ++++++++++++++-------------- .github/workflows/ubuntu-6.2.yml | 11 +++--- .github/workflows/ubuntu.yml | 59 ++++++++++++++++--------------- .github/workflows/windows-6.2.yml | 13 ++++--- .github/workflows/windows.yml | 56 ++++++++++++++--------------- 7 files changed, 108 insertions(+), 99 deletions(-) diff --git a/.github/workflows/macos copy.yml b/.github/workflows/macos copy.yml index 03974885..50e700d3 100644 --- a/.github/workflows/macos copy.yml +++ b/.github/workflows/macos copy.yml @@ -36,6 +36,7 @@ jobs: qt_arch: [clang_64] env: targetName: GoldenDict + version: 22.2.alpha steps: # macos 11.0 默认环境变了,要指定 - name: prepare env @@ -86,7 +87,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ env.targetName }}.dmg asset_name: ${{ env.targetName }}-M1_${{ matrix.os }}_${{ matrix.qt_ver }}_${{ steps.vars.outputs.sha_short }}.dmg - tag: v${{ steps.autotag.outputs.version }}-${{ steps.vars.outputs.sha_short }} + tag: v${{env.version}}-${{ steps.vars.outputs.sha_short }} overwrite: true release_name: win-ubuntu-macos-${{ github.ref_name }}-${{steps.vars.outputs.release_date}} prerelease: true diff --git a/.github/workflows/macos-6.2.yml b/.github/workflows/macos-6.2.yml index 405e8c97..4ae2a5d0 100644 --- a/.github/workflows/macos-6.2.yml +++ b/.github/workflows/macos-6.2.yml @@ -56,7 +56,7 @@ jobs: - uses: actions/checkout@v3 with: - fetch-depth: 1 + fetch-depth: 0 - name: Set outputs id: githash run: | @@ -82,8 +82,11 @@ jobs: previousTag=$(git tag --sort=-creatordate | sed -n 2p) echo "previousTag : $previousTag" - commitSummary="$(git shortlog $previousTag..HEAD)" - echo "::set-output name=COMMIT_SUMMARY::\"$commitSummary\"" + CHANGELOG="$(git shortlog $previousTag..HEAD)" + CHANGELOG="${CHANGELOG//'%'/'%25'}" + CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" + CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" + echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")" # tag 上传Release - name: uploadRelease uses: svenstaro/upload-release-action@v2 @@ -91,7 +94,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ env.targetName }}.dmg asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{ steps.vars.outputs.sha_short }}.dmg - tag: v${{ steps.autotag.outputs.version }}-${{ steps.vars.outputs.sha_short }} + tag: v${{env.version}}-${{ steps.vars.outputs.sha_short }} overwrite: true release_name: win-ubuntu-macos-${{ github.ref_name }}-${{steps.vars.outputs.release_date}} prerelease: true diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index ccf06851..a8e8f1f3 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -3,28 +3,31 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: + workflow_run: + workflows: [AutoTag] + types: [completed] workflow_dispatch: - push: - branches: - - dev - - master - # - staged - paths-ignore: - - 'docs/**' - - ".github/**" - - "howto/**" - - "*.md" - - ".clang-format" - pull_request: - branches: - - dev - - master - # - staged - paths-ignore: - - 'docs/**' - - ".github/**" - - "howto/**" - - "*.md" + # push: + # branches: + # - dev + # - master + # # - staged + # paths-ignore: + # - 'docs/**' + # - ".github/**" + # - "howto/**" + # - "*.md" + # - ".clang-format" + # pull_request: + # branches: + # - dev + # - master + # # - staged + # paths-ignore: + # - 'docs/**' + # - ".github/**" + # - "howto/**" + # - "*.md" jobs: build: name: Build @@ -61,12 +64,7 @@ jobs: id: githash run: | echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" - - uses: Klemensas/action-autotag@stable - id: autotag - with: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - tag_prefix: "v" - tag_suffix: "-${{ steps.githash.outputs.sha_short }}" + - name: build macos run: | @@ -101,7 +99,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ env.targetName }}.dmg asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{ steps.vars.outputs.sha_short }}.dmg - tag: v${{ steps.autotag.outputs.version }}-${{ steps.vars.outputs.sha_short }} + tag: v${{env.version}}-${{ steps.vars.outputs.sha_short }} overwrite: true release_name: win-ubuntu-macos-${{ github.ref_name }}-${{steps.vars.outputs.release_date}} prerelease: true diff --git a/.github/workflows/ubuntu-6.2.yml b/.github/workflows/ubuntu-6.2.yml index 673b4e57..80c84586 100644 --- a/.github/workflows/ubuntu-6.2.yml +++ b/.github/workflows/ubuntu-6.2.yml @@ -65,7 +65,7 @@ jobs: cd .. - uses: actions/checkout@v3 with: - fetch-depth: 1 + fetch-depth: 0 - name: Set outputs id: githash @@ -106,8 +106,11 @@ jobs: previousTag=$(git tag --sort=-creatordate | sed -n 2p) echo "previousTag : $previousTag" - commitSummary="$(git shortlog $previousTag..HEAD)" - echo "::set-output name=COMMIT_SUMMARY::\"$commitSummary\"" + CHANGELOG="$(git shortlog $previousTag..HEAD)" + CHANGELOG="${CHANGELOG//'%'/'%25'}" + CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" + CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" + echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")" - name: uploadRelease # if: startsWith(github.event.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 @@ -115,7 +118,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ steps.vars.outputs.appname }} asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }} - tag: v${{ steps.autotag.outputs.version }}-${{ steps.vars.outputs.sha_short }} + tag: v${{env.version}}-${{ steps.vars.outputs.sha_short }} overwrite: true release_name: win-ubuntu-macos-${{ github.ref_name }}-${{steps.vars.outputs.release_date}} prerelease: true diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 9ff6fd0f..da17fbcf 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -4,28 +4,31 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: + workflow_run: + workflows: [AutoTag] + types: [completed] workflow_dispatch: - push: - branches: - - dev - - master - # - staged - paths-ignore: - - 'docs/**' - - ".github/**" - - "howto/**" - - "*.md" - - ".clang-format" - pull_request: - branches: - - dev - - master - # - staged - paths-ignore: - - 'docs/**' - - ".github/**" - - "howto/**" - - "*.md" + # push: + # branches: + # - dev + # - master + # # - staged + # paths-ignore: + # - 'docs/**' + # - ".github/**" + # - "howto/**" + # - "*.md" + # - ".clang-format" + # pull_request: + # branches: + # - dev + # - master + # # - staged + # paths-ignore: + # - 'docs/**' + # - ".github/**" + # - "howto/**" + # - "*.md" jobs: build: name: Build @@ -62,12 +65,12 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - run: | - short_sha=$(git rev-parse --short HEAD) - tagname=v$version-$short_sha - echo $tagname - git tag $tagname -f - git push origin $tagname + # - run: | + # short_sha=$(git rev-parse --short HEAD) + # tagname=v$version-$short_sha + # echo $tagname + # git tag $tagname -f + # git push origin $tagname - name: Set git short sha id: githash @@ -111,7 +114,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ steps.vars.outputs.appname }} asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }} - tag: v$version-${{ steps.vars.outputs.sha_short }} + tag: v${{env.version}}-${{ steps.vars.outputs.sha_short }} overwrite: true release_name: win-ubuntu-macos-${{ github.ref_name }}-${{steps.vars.outputs.release_date}} prerelease: true diff --git a/.github/workflows/windows-6.2.yml b/.github/workflows/windows-6.2.yml index 447f50bc..56b836d2 100644 --- a/.github/workflows/windows-6.2.yml +++ b/.github/workflows/windows-6.2.yml @@ -71,7 +71,7 @@ jobs: # 拉取代码 - uses: actions/checkout@v3 with: - fetch-depth: 1 + fetch-depth: 0 - name: Set outputs id: githash run: | @@ -95,8 +95,11 @@ jobs: previousTag=$(git tag --sort=-creatordate | sed -n 2p) echo "previousTag : $previousTag" - commitSummary="$(git shortlog $previousTag..HEAD)" - echo "::set-output name=COMMIT_SUMMARY::\"$commitSummary\"" + CHANGELOG="$(git shortlog $previousTag..HEAD)" + CHANGELOG="${CHANGELOG//'%'/'%25'}" + CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" + CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" + echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")" # msvc编译 - uses: ilammy/msvc-dev-cmd@v1 @@ -141,7 +144,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ steps.package.outputs.packageName }}.zip asset_name: ${{ matrix.qt_ver }}-${{ steps.package.outputs.packageName }}.zip - tag: v${{ steps.autotag.outputs.version }}-${{ steps.vars.outputs.sha_short }} + tag: v${{env.version}}-${{ steps.vars.outputs.sha_short }} overwrite: true release_name: win-ubuntu-macos-${{ github.ref_name }}-${{steps.vars.outputs.release_date}} prerelease: true @@ -161,7 +164,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: release/${{ env.targetName }} asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }} - tag: v${{ steps.autotag.outputs.version }}-${{ steps.vars.outputs.sha_short }} + tag: v${{env.version}}-${{ steps.vars.outputs.sha_short }} overwrite: true release_name: win-ubuntu-macos-${{ github.ref_name }}-${{steps.vars.outputs.release_date}} prerelease: true diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 24990b36..5b0c7a80 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -3,29 +3,32 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: + workflow_run: + workflows: [AutoTag] + types: [completed] workflow_dispatch: # push代码时触发workflow - push: - branches: - - dev - - master - # - staged - paths-ignore: - - 'docs/**' - - ".github/**" - - "howto/**" - - "*.md" - - ".clang-format" - pull_request: - branches: - - dev - - master - # - staged - paths-ignore: - - 'docs/**' - - ".github/**" - - "howto/**" - - "*.md" + # push: + # branches: + # - dev + # - master + # # - staged + # paths-ignore: + # - 'docs/**' + # - ".github/**" + # - "howto/**" + # - "*.md" + # - ".clang-format" + # pull_request: + # branches: + # - dev + # - master + # # - staged + # paths-ignore: + # - 'docs/**' + # - ".github/**" + # - "howto/**" + # - "*.md" jobs: build: name: Build @@ -72,12 +75,7 @@ jobs: id: githash run: | echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" - - uses: Klemensas/action-autotag@stable - id: autotag - with: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - tag_prefix: "v" - tag_suffix: "-${{ steps.githash.outputs.sha_short }}" + - name: Set outputs id: vars shell: bash @@ -135,7 +133,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ steps.package.outputs.packageName }}.zip asset_name: ${{ matrix.qt_ver }}-${{ steps.package.outputs.packageName }}.zip - tag: v${{ steps.autotag.outputs.version }}-${{ steps.vars.outputs.sha_short }} + tag: v${{env.version}}-${{ steps.vars.outputs.sha_short }} overwrite: true release_name: win-ubuntu-macos-${{ github.ref_name }}-${{steps.vars.outputs.release_date}} prerelease: true @@ -160,7 +158,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: release/${{ env.targetName }} asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }} - tag: v${{ steps.autotag.outputs.version }}-${{ steps.vars.outputs.sha_short }} + tag: v${{env.version}}-${{ steps.vars.outputs.sha_short }} overwrite: true release_name: win-ubuntu-macos-${{ github.ref_name }}-${{steps.vars.outputs.release_date}} prerelease: true