action: update tag when upload release (#883)

* action: use custom tag when upload-release

* action: valid tag must begin with v

* action: use custom tag when upload-release

---------

Co-authored-by: YiFang Xiao <yifang.xiao@noreply.com>
This commit is contained in:
xiaoyifang 2023-06-20 15:56:26 +08:00 committed by GitHub
parent 34f6cb9ddc
commit 074c7a0aca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 16 deletions

View file

@ -94,7 +94,7 @@ jobs:
- name: version-file - name: version-file
shell: bash shell: bash
run: | run: |
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-) current_tag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt echo "$current_tag">version.txt
- name: compile - name: compile
run: | run: |
@ -120,7 +120,7 @@ jobs:
- name: changelog - name: changelog
id: changelog id: changelog
run: | run: |
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p) previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
echo "previousTag : $previousTag" echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)" CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -131,7 +131,7 @@ jobs:
CHANGELOG="${CHANGELOG//"'"/ }" CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")" echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag" echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)" echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)"
- name: Set outputs - name: Set outputs
id: vars id: vars
@ -190,6 +190,7 @@ jobs:
file: ${{ env.targetName }}.dmg file: ${{ env.targetName }}.dmg
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_homebrew_${{steps.vars.outputs.release_date}}.dmg asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_homebrew_${{steps.vars.outputs.release_date}}.dmg
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}

View file

@ -79,7 +79,7 @@ jobs:
- name: version-file - name: version-file
shell: bash shell: bash
run: | run: |
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-) current_tag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt echo "$current_tag">version.txt
- name: build goldendict - name: build goldendict
@ -108,7 +108,7 @@ jobs:
- name: changelog - name: changelog
id: changelog id: changelog
run: | run: |
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p) previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
echo "previousTag : $previousTag" echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)" CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -119,7 +119,7 @@ jobs:
CHANGELOG="${CHANGELOG//"'"/ }" CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")" echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag" echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)" echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)"
- name: Set outputs - name: Set outputs
id: vars id: vars
@ -179,6 +179,7 @@ jobs:
file: ${{ steps.vars.outputs.appname }} file: ${{ steps.vars.outputs.appname }}
asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }} asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }}
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}

View file

@ -66,7 +66,7 @@ jobs:
- name: version-file - name: version-file
shell: bash shell: bash
run: | run: |
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-) current_tag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt echo "$current_tag">version.txt
- name: build goldendict - name: build goldendict
@ -91,7 +91,7 @@ jobs:
- name: changelog - name: changelog
id: changelog id: changelog
run: | run: |
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p) previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
echo "previousTag : $previousTag" echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)" CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -102,7 +102,7 @@ jobs:
CHANGELOG="${CHANGELOG//"'"/ }" CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")" echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag" echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)" echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)"
- name: Set outputs - name: Set outputs
id: vars id: vars
run: | run: |
@ -160,7 +160,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.vars.outputs.appname }} file: ${{ steps.vars.outputs.appname }}
asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }} asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }}
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}

View file

@ -56,7 +56,7 @@ jobs:
id: changelog id: changelog
shell: bash shell: bash
run: | run: |
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p) previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
echo "previousTag : $previousTag" echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)" CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -67,7 +67,7 @@ jobs:
CHANGELOG="${CHANGELOG//"'"/ }" CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")" echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag" echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)" echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)"
- name: "Build Changelog" - name: "Build Changelog"
id: build_changelog id: build_changelog
@ -129,7 +129,7 @@ jobs:
- name: version-file - name: version-file
shell: bash shell: bash
run: | run: |
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-) current_tag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt echo "$current_tag">version.txt
cat version.txt cat version.txt
@ -183,6 +183,7 @@ jobs:
file: ${{ steps.package.outputs.packageName }}.zip file: ${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{steps.vars.outputs.release_date}}.zip asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{steps.vars.outputs.release_date}}.zip
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}
@ -223,6 +224,7 @@ jobs:
file: release/${{ env.targetName }} file: release/${{ env.targetName }}
asset_name: ${{ matrix.qt_ver }}.${{ matrix.os }}-${{ env.targetName }} asset_name: ${{ matrix.qt_ver }}.${{ matrix.os }}-${{ env.targetName }}
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}
@ -234,6 +236,7 @@ jobs:
file: release/GoldenDict.pdb file: release/GoldenDict.pdb
asset_name: ${{ matrix.qt_ver }}.${{ matrix.os }}-GoldenDict.pdb asset_name: ${{ matrix.qt_ver }}.${{ matrix.os }}-GoldenDict.pdb
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}
@ -258,6 +261,7 @@ jobs:
file: ${{ steps.package.outputs.packageName }}/GoldenDict-ng-v23-Installer.exe file: ${{ steps.package.outputs.packageName }}/GoldenDict-ng-v23-Installer.exe
asset_name: ${{ matrix.qt_ver }}-GoldenDict-ng-Installer.exe asset_name: ${{ matrix.qt_ver }}-GoldenDict-ng-Installer.exe
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}

View file

@ -59,7 +59,7 @@ jobs:
id: changelog id: changelog
shell: bash shell: bash
run: | run: |
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p) previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
echo "previousTag : $previousTag" echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)" CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -70,7 +70,7 @@ jobs:
CHANGELOG="${CHANGELOG//"'"/ }" CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")" echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag" echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)" echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)"
- name: Set outputs - name: Set outputs
id: vars id: vars
@ -85,7 +85,7 @@ jobs:
- name: version-file - name: version-file
shell: bash shell: bash
run: | run: |
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-) current_tag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt echo "$current_tag">version.txt
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
@ -164,6 +164,7 @@ jobs:
file: ${{ steps.package.outputs.packageName }}.zip file: ${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{steps.vars.outputs.release_date}}.zip asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{steps.vars.outputs.release_date}}.zip
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}
@ -206,6 +207,7 @@ jobs:
file: release/${{ env.targetName }} file: release/${{ env.targetName }}
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }} asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}
@ -234,6 +236,7 @@ jobs:
file: ${{ steps.package.outputs.packageName }}/GoldenDict-ng-v23-Installer.exe file: ${{ steps.package.outputs.packageName }}/GoldenDict-ng-v23-Installer.exe
asset_name: ${{ matrix.qt_ver }}-GoldenDict-ng-Installer.exe asset_name: ${{ matrix.qt_ver }}-GoldenDict-ng-Installer.exe
tag: latest-tag-ignore
overwrite: true overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}} prerelease: ${{env.prerelease}}