github: release version extracted into a variable .

in the future release ,  prerelease and release version can share this same variable.
reduce the code changes when publish a new release version.
This commit is contained in:
Xiao YiFang 2022-05-13 20:31:51 +08:00
parent 416cd94542
commit 609cfa74b5
9 changed files with 58 additions and 40 deletions

View file

@ -22,7 +22,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
version: 22.4.24-alpha version: 22.4.24
version-suffix: alpha
prerelease: true
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -37,7 +39,7 @@ jobs:
uses: mathieudutour/github-tag-action@v6.0 uses: mathieudutour/github-tag-action@v6.0
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} custom_tag: ${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}

View file

@ -29,7 +29,9 @@ jobs:
qt_arch: [clang_64] qt_arch: [clang_64]
env: env:
targetName: GoldenDict targetName: GoldenDict
version: 22.4.24-alpha version: 22.4.24
version-suffix: alpha
prerelease: true
steps: steps:
# macos 11.0 默认环境变了,要指定 # macos 11.0 默认环境变了,要指定
@ -97,10 +99,10 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.targetName }}.dmg file: ${{ env.targetName }}.dmg
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{ steps.vars.outputs.sha_short }}.dmg asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{ steps.vars.outputs.sha_short }}.dmg
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}
body: | body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}} release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }} branch: ${{ github.ref_name }}

View file

@ -30,7 +30,9 @@ jobs:
qt_arch: [clang_64] qt_arch: [clang_64]
env: env:
targetName: GoldenDict targetName: GoldenDict
version: 22.4.24-alpha version: 22.4.24
version-suffix: alpha
prerelease: true
steps: steps:
# macos 11.0 默认环境变了,要指定 # macos 11.0 默认环境变了,要指定
@ -100,10 +102,10 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.targetName }}.dmg file: ${{ env.targetName }}.dmg
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{ steps.vars.outputs.sha_short }}.dmg asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{ steps.vars.outputs.sha_short }}.dmg
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}
body: | body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}} release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }} branch: ${{ github.ref_name }}

View file

@ -30,7 +30,9 @@ jobs:
qt_ver: [6.2.4,6.3.0] qt_ver: [6.2.4,6.3.0]
qt_arch: [gcc_64] qt_arch: [gcc_64]
env: env:
version: 22.4.24-alpha version: 22.4.24
version-suffix: alpha
prerelease: true
steps: steps:
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v3 uses: jurplel/install-qt-action@v3
@ -104,10 +106,10 @@ 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: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}
body: | body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}} release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }} branch: ${{ github.ref_name }}

View file

@ -24,7 +24,9 @@ jobs:
qt_ver: [5.15.2,6.2.4] qt_ver: [5.15.2,6.2.4]
qt_arch: [gcc_64] qt_arch: [gcc_64]
env: env:
version: 22.4.24-alpha version: 22.4.24
version-suffix: alpha
prerelease: true
steps: steps:
- uses: actions/setup-python@v3 - uses: actions/setup-python@v3
with: with:

View file

@ -30,7 +30,9 @@ jobs:
qt_ver: [5.15.2] qt_ver: [5.15.2]
qt_arch: [gcc_64] qt_arch: [gcc_64]
env: env:
version: 22.4.24-alpha version: 22.4.24
version-suffix: alpha
prerelease: true
steps: steps:
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v3 uses: jurplel/install-qt-action@v3
@ -101,10 +103,10 @@ 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: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}
body: | body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}} release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }} branch: ${{ github.ref_name }}

View file

@ -31,7 +31,9 @@ jobs:
qt_arch: [win64_msvc2019_64] qt_arch: [win64_msvc2019_64]
env: env:
targetName: GoldenDict.exe targetName: GoldenDict.exe
version: 22.4.24-alpha version: 22.4.24
version-suffix: alpha
prerelease: true
steps: steps:
- uses: actions/setup-python@v3 - uses: actions/setup-python@v3
with: with:
@ -111,10 +113,10 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}.zip file: ${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ matrix.qt_ver }}-${{ steps.package.outputs.packageName }}.zip asset_name: ${{ matrix.qt_ver }}-${{ steps.package.outputs.packageName }}.zip
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}
body: | body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}} release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }} branch: ${{ github.ref_name }}
@ -131,10 +133,10 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release/${{ env.targetName }} file: release/${{ env.targetName }}
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }} asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}
- name: copy nsis - name: copy nsis
shell: bash shell: bash
@ -156,7 +158,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}/GoldenDict-v22-Install.exe file: ${{ steps.package.outputs.packageName }}/GoldenDict-v22-Install.exe
asset_name: ${{ matrix.qt_ver }}-GoldenDict-v22-Install.exe asset_name: ${{ matrix.qt_ver }}-GoldenDict-v22-Install.exe
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}

View file

@ -27,7 +27,9 @@ jobs:
env: env:
targetName: GoldenDict.exe targetName: GoldenDict.exe
version: 22.4.24-alpha version: 22.4.24
version-suffix: alpha
prerelease: true
steps: steps:
- uses: actions/setup-python@v3 - uses: actions/setup-python@v3
with: with:

View file

@ -32,7 +32,9 @@ jobs:
qt_arch: [win64_msvc2019_64] qt_arch: [win64_msvc2019_64]
env: env:
targetName: GoldenDict.exe targetName: GoldenDict.exe
version: 22.4.24-alpha version: 22.4.24
version-suffix: alpha
prerelease: true
# 步骤 # 步骤
steps: steps:
# 安装Qt # 安装Qt
@ -106,10 +108,10 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}.zip file: ${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ matrix.qt_ver }}-${{ steps.package.outputs.packageName }}.zip asset_name: ${{ matrix.qt_ver }}-${{ steps.package.outputs.packageName }}.zip
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}
body: | body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}} release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }} branch: ${{ github.ref_name }}
@ -131,10 +133,10 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release/${{ env.targetName }} file: release/${{ env.targetName }}
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }} asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}
- name: copy nsis - name: copy nsis
@ -159,8 +161,8 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}/GoldenDict-v22-Install.exe file: ${{ steps.package.outputs.packageName }}/GoldenDict-v22-Install.exe
asset_name: ${{ matrix.qt_ver }}-GoldenDict-v22-Install.exe asset_name: ${{ matrix.qt_ver }}-GoldenDict-v22-Install.exe
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true prerelease: ${{env.prerelease}}