mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 05:53:27 -07:00
Do not use actual version number when creating a release from branch
This commit is contained in:
parent
aa98a7ce78
commit
aacec55d1e
1 changed files with 34 additions and 6 deletions
40
.github/workflows/release.yml
vendored
40
.github/workflows/release.yml
vendored
|
@ -1,3 +1,7 @@
|
||||||
|
env:
|
||||||
|
IS_RELEASE_BRANCH: ${{ startsWith(github.ref, 'refs/heads/release/') }}
|
||||||
|
BRANCH_NAME: ${{ github.ref_name }}
|
||||||
|
|
||||||
name: Build and Deploy
|
name: Build and Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
@ -5,6 +9,12 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'release/1.*'
|
- 'release/1.*'
|
||||||
|
paths-ignore:
|
||||||
|
- '.github/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '*.md'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'build-and-deploy.ps1'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -85,7 +95,8 @@ jobs:
|
||||||
path: drop # Local folder where artifacts are downloaded
|
path: drop # Local folder where artifacts are downloaded
|
||||||
|
|
||||||
- name: Extract version from file name
|
- name: Extract version from file name
|
||||||
id: extract_version
|
if: env.IS_RELEASE_BRANCH == 'true'
|
||||||
|
id: version_from_filename
|
||||||
run: |
|
run: |
|
||||||
$file = Get-ChildItem drop -Filter "Greenshot-INSTALLER-*.exe" | Select-Object -First 1
|
$file = Get-ChildItem drop -Filter "Greenshot-INSTALLER-*.exe" | Select-Object -First 1
|
||||||
if (-not $file) {
|
if (-not $file) {
|
||||||
|
@ -98,21 +109,38 @@ jobs:
|
||||||
}
|
}
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
|
- name: Set version from sanitized branch name
|
||||||
|
if: env.IS_RELEASE_BRANCH != 'true'
|
||||||
|
id: version_from_branchname
|
||||||
|
run: |
|
||||||
|
$branch = "${{ github.ref }}" -replace '^refs/heads/', ''
|
||||||
|
$sanitized = $branch -replace '[^a-zA-Z0-9._-]', '_'
|
||||||
|
echo "version=$sanitized" >> $Env:GITHUB_OUTPUT
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
|
- name: Set version info
|
||||||
|
id: version_info
|
||||||
|
run: |
|
||||||
|
echo "version=${{ steps.version_from_filename.outputs.version || steps.version_from_branchname.outputs.version }}" >> $GITHUB_OUTPUT
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
|
||||||
- name: Create tag
|
- name: Create tag
|
||||||
|
if: env.IS_RELEASE_BRANCH == 'true'
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git tag -a "v${{ steps.extract_version.outputs.version }}" -m "v${{ steps.extract_version.outputs.version }}"
|
git tag -a "v${{ steps.version_info.outputs.version }}" -m "v${{ steps.version_info.outputs.version }}"
|
||||||
git push origin "v${{ steps.extract_version.outputs.version }}"
|
git push origin "v${{ steps.version_info.outputs.version }}"
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
name: "Greenshot ${{ steps.extract_version.outputs.version }} (continuous build)"
|
name: "Greenshot ${{ steps.version_info.outputs.version }} (continuous build)"
|
||||||
tag_name: "v${{ steps.extract_version.outputs.version }}"
|
tag_name: ${{ env.IS_RELEASE_BRANCH == 'true' && format('v{0}', steps.version_info.outputs.version) || env.BRANCH_NAME }}
|
||||||
files: drop/*.exe
|
files: drop/*.exe
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
draft: false
|
draft: ${{ env.IS_RELEASE_BRANCH != 'true' }}
|
||||||
prerelease: true
|
prerelease: true
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue