mirror of
https://github.com/greenshot/greenshot
synced 2025-07-05 20:42:14 -07:00
Add Release Script (#581)
This commit is contained in:
parent
245f6f261b
commit
cac566c70a
13 changed files with 400 additions and 147 deletions
126
.github/workflows/release.yml
vendored
Normal file
126
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
name: Build and Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'release/1.*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup MSBuild
|
||||||
|
uses: microsoft/setup-msbuild@v2
|
||||||
|
|
||||||
|
- name: Set up .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '7.x'
|
||||||
|
|
||||||
|
- name: Restore NuGet packages
|
||||||
|
run: msbuild src/Greenshot.sln /p:Configuration=Release /restore /t:PrepareForBuild
|
||||||
|
env:
|
||||||
|
Box13_ClientId: ${{ secrets.Box13_ClientId }}
|
||||||
|
Box13_ClientSecret: ${{ secrets.Box13_ClientSecret }}
|
||||||
|
DropBox13_ClientId: ${{ secrets.DropBox13_ClientId }}
|
||||||
|
DropBox13_ClientSecret: ${{ secrets.DropBox13_ClientSecret }}
|
||||||
|
Flickr_ClientId: ${{ secrets.Flickr_ClientId }}
|
||||||
|
Flickr_ClientSecret: ${{ secrets.Flickr_ClientSecret }}
|
||||||
|
Imgur13_ClientId: ${{ secrets.Imgur13_ClientId }}
|
||||||
|
Imgur13_ClientSecret: ${{ secrets.Imgur13_ClientSecret }}
|
||||||
|
Photobucket_ClientId: ${{ secrets.Photobucket_ClientId }}
|
||||||
|
Photobucket_ClientSecret: ${{ secrets.Photobucket_ClientSecret }}
|
||||||
|
Picasa_ClientId: ${{ secrets.Picasa_ClientId }}
|
||||||
|
Picasa_ClientSecret: ${{ secrets.Picasa_ClientSecret }}
|
||||||
|
|
||||||
|
- name: Build and package
|
||||||
|
run: msbuild src/Greenshot.sln /p:Configuration=Release /t:Rebuild /v:normal
|
||||||
|
env:
|
||||||
|
Box13_ClientId: ${{ secrets.Box13_ClientId }}
|
||||||
|
Box13_ClientSecret: ${{ secrets.Box13_ClientSecret }}
|
||||||
|
DropBox13_ClientId: ${{ secrets.DropBox13_ClientId }}
|
||||||
|
DropBox13_ClientSecret: ${{ secrets.DropBox13_ClientSecret }}
|
||||||
|
Flickr_ClientId: ${{ secrets.Flickr_ClientId }}
|
||||||
|
Flickr_ClientSecret: ${{ secrets.Flickr_ClientSecret }}
|
||||||
|
Imgur13_ClientId: ${{ secrets.Imgur13_ClientId }}
|
||||||
|
Imgur13_ClientSecret: ${{ secrets.Imgur13_ClientSecret }}
|
||||||
|
Photobucket_ClientId: ${{ secrets.Photobucket_ClientId }}
|
||||||
|
Photobucket_ClientSecret: ${{ secrets.Photobucket_ClientSecret }}
|
||||||
|
Picasa_ClientId: ${{ secrets.Picasa_ClientId }}
|
||||||
|
Picasa_ClientSecret: ${{ secrets.Picasa_ClientSecret }}
|
||||||
|
|
||||||
|
- name: Copy Files
|
||||||
|
run: |
|
||||||
|
mkdir -p ${{ github.workspace }}/artifacts
|
||||||
|
cp installer/Greenshot-INSTALLER-*.exe ${{ github.workspace }}/artifacts/
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: drop
|
||||||
|
path: ${{ github.workspace }}/artifacts
|
||||||
|
|
||||||
|
# deploy:
|
||||||
|
# runs-on: windows-latest
|
||||||
|
# needs: build
|
||||||
|
#
|
||||||
|
# steps:
|
||||||
|
#
|
||||||
|
# - name: Checkout repository
|
||||||
|
# uses: actions/checkout@v2
|
||||||
|
# with:
|
||||||
|
# fetch-depth: 0
|
||||||
|
#
|
||||||
|
# - name: Download build artifacts
|
||||||
|
# uses: actions/download-artifact@v4
|
||||||
|
# with:
|
||||||
|
# name: drop Name of the artifact uploaded in previous steps
|
||||||
|
# path: drop Local folder where artifacts are downloaded
|
||||||
|
#
|
||||||
|
# - name: Extract version from file name
|
||||||
|
# id: extract_version
|
||||||
|
# run: |
|
||||||
|
# $file = Get-ChildItem drop -Filter "Greenshot-INSTALLER-*.exe" | Select-Object -First 1
|
||||||
|
# if (-not $file) {
|
||||||
|
# throw "No matching file found in 'drop' directory."
|
||||||
|
# }
|
||||||
|
# if ($file.Name -match "Greenshot-INSTALLER-([\d\.]+).*\.exe") {
|
||||||
|
# echo "version=$($matches[1])" >> $Env:GITHUB_OUTPUT
|
||||||
|
# } else {
|
||||||
|
# throw "Version number could not be extracted from file name: $($file.Name)"
|
||||||
|
# }
|
||||||
|
# shell: pwsh
|
||||||
|
#
|
||||||
|
# - name: Create tag
|
||||||
|
# run: |
|
||||||
|
# git config user.name "github-actions[bot]"
|
||||||
|
# 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 push origin "v${{ steps.extract_version.outputs.version }}"
|
||||||
|
#
|
||||||
|
# - name: Create GitHub Release
|
||||||
|
# uses: softprops/action-gh-release@v2
|
||||||
|
# with:
|
||||||
|
# name: "Greenshot ${{ steps.extract_version.outputs.version }} unstable"
|
||||||
|
# tag_name: "v${{ steps.extract_version.outputs.version }}"
|
||||||
|
# files: drop/*.exe
|
||||||
|
# generate_release_notes: true
|
||||||
|
# draft: true
|
||||||
|
# prerelease: true
|
||||||
|
# env:
|
||||||
|
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
#
|
||||||
|
# - name: Trigger GitHub Pages rebuild
|
||||||
|
# shell: bash
|
||||||
|
# run: |
|
||||||
|
# curl -X POST \
|
||||||
|
# -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
# -H "Accept: application/vnd.github+json" \
|
||||||
|
# https://api.github.com/repos/${{ github.repository }}/pages/builds
|
||||||
|
|
18
.github/workflows/update-gh-pages.yml
vendored
Normal file
18
.github/workflows/update-gh-pages.yml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
name: Update GitHub Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-gh-pages:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Trigger GitHub Pages rebuild
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -X POST \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.GH_PAT_JKL }}" \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
https://api.github.com/repos/${{ github.repository }}/pages/builds
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -215,3 +215,5 @@ ModelManifest.xml
|
||||||
|
|
||||||
# Rider files
|
# Rider files
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
/installer/Greenshot-INSTALLER-*.exe
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
# .NET Desktop
|
|
||||||
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
|
|
||||||
# Add steps that publish symbols, save build artifacts, and more:
|
|
||||||
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
batch: true
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- 'release/1.*'
|
|
||||||
exclude:
|
|
||||||
- 'develop'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- stage: Build
|
|
||||||
jobs:
|
|
||||||
- job: Build
|
|
||||||
variables:
|
|
||||||
- group: 'Plug-in Credentials'
|
|
||||||
- name: solution
|
|
||||||
value: 'src/Greenshot.sln'
|
|
||||||
- name: buildPlatform
|
|
||||||
value: 'Any CPU'
|
|
||||||
- name: buildConfiguration
|
|
||||||
value: 'Release'
|
|
||||||
|
|
||||||
pool:
|
|
||||||
vmImage: 'Windows-latest'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- task: MSBuild@1
|
|
||||||
displayName: Restore nuget packages and generate credential templates
|
|
||||||
inputs:
|
|
||||||
solution: '$(solution)'
|
|
||||||
platform: $(buildPlatform)
|
|
||||||
configuration: $(buildConfiguration)
|
|
||||||
msbuildArguments: '/restore /t:PrepareForBuild'
|
|
||||||
|
|
||||||
- task: MSBuild@1
|
|
||||||
displayName: Build and package
|
|
||||||
inputs:
|
|
||||||
solution: '$(solution)'
|
|
||||||
platform: $(buildPlatform)
|
|
||||||
configuration: $(buildConfiguration)
|
|
||||||
env:
|
|
||||||
Box13_ClientId: $(Box13_ClientId)
|
|
||||||
Box13_ClientSecret: $(Box13_ClientSecret)
|
|
||||||
DropBox13_ClientId: $(DropBox13_ClientId)
|
|
||||||
DropBox13_ClientSecret: $(DropBox13_ClientSecret)
|
|
||||||
Flickr_ClientId: $(Flickr_ClientId)
|
|
||||||
Flickr_ClientSecret: $(Flickr_ClientSecret)
|
|
||||||
Imgur13_ClientId: $(Imgur13_ClientId)
|
|
||||||
Imgur13_ClientSecret: $(Imgur13_ClientSecret)
|
|
||||||
Photobucket_ClientId: $(Photobucket_ClientId)
|
|
||||||
Photobucket_ClientSecret: $(Photobucket_ClientSecret)
|
|
||||||
Picasa_ClientId: $(Picasa_ClientId)
|
|
||||||
Picasa_ClientSecret: $(Picasa_ClientSecret)
|
|
||||||
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
|
|
||||||
inputs:
|
|
||||||
SourceFolder: '$(Build.SourcesDirectory)\installer'
|
|
||||||
Contents: Greenshot-INSTALLER-*.exe
|
|
||||||
TargetFolder: '$(build.artifactstagingdirectory)'
|
|
||||||
flattenFolders: true
|
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
|
||||||
displayName: 'Publish Artifact: drop'
|
|
||||||
inputs:
|
|
||||||
PathtoPublish: '$(build.artifactstagingdirectory)'
|
|
||||||
|
|
||||||
- stage: Deploy
|
|
||||||
jobs:
|
|
||||||
- deployment: GitHub_Release
|
|
||||||
pool:
|
|
||||||
vmImage: 'Windows-latest'
|
|
||||||
|
|
||||||
environment: 'GitHub Release'
|
|
||||||
strategy:
|
|
||||||
# default deployment strategy
|
|
||||||
runOnce:
|
|
||||||
deploy:
|
|
||||||
steps:
|
|
||||||
- download: current
|
|
||||||
artifact: drop
|
|
||||||
|
|
||||||
# Create a GitHub release
|
|
||||||
- task: GitHubRelease@0
|
|
||||||
inputs:
|
|
||||||
gitHubConnection: GitHub Release
|
|
||||||
repositoryName: '$(Build.Repository.Name)'
|
|
||||||
action: 'create' # Options: create, edit, delete
|
|
||||||
target: '$(Build.SourceVersion)' # Required when action == Create || Action == Edit
|
|
||||||
tagSource: 'manual' # Required when action == Create# Options: auto, manual
|
|
||||||
tag: 'v$(Build.BuildNumber)' # Required when action == Edit || Action == Delete || TagSource == Manual
|
|
||||||
title: Greenshot $(Build.BuildNumber) unstable # Optional
|
|
||||||
#releaseNotesSource: 'file' # Optional. Options: file, input
|
|
||||||
#releaseNotesFile: # Optional
|
|
||||||
#releaseNotes: # Optional
|
|
||||||
assets: '$(Pipeline.Workspace)/drop/*.exe'
|
|
||||||
#assetUploadMode: 'delete' # Optional. Options: delete, replace
|
|
||||||
isDraft: true # Optional
|
|
||||||
isPreRelease: true # Optional
|
|
||||||
addChangeLog: true # Optional
|
|
||||||
#compareWith: 'lastFullRelease' # Required when addChangeLog == True. Options: lastFullRelease, lastRelease, lastReleaseByTag
|
|
||||||
#releaseTag: # Required when compareWith == LastReleaseByTag
|
|
149
build-and-deploy.ps1
Normal file
149
build-and-deploy.ps1
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
# USAGE
|
||||||
|
# * Enable script execution in Powershell: 'Set-ExecutionPolicy RemoteSigned'
|
||||||
|
# * Create a GitHub personal access token (PAT) for greenshot repository
|
||||||
|
# * user must be owner of the repository
|
||||||
|
# * token needs read and write permissions ""for Contents"" and ""Pages""
|
||||||
|
# * Execute the script and paste your token
|
||||||
|
|
||||||
|
# Prompt the user to securely input the Github token
|
||||||
|
$SecureToken = Read-Host "Please enter your GitHub personal access token" -AsSecureString
|
||||||
|
$ReleaseToken = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureToken))
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
$RepoPath = "." # Replace with your local repo path
|
||||||
|
$ArtifactsPath = "$RepoPath\artifacts"
|
||||||
|
$SolutionFile = "$RepoPath\src\Greenshot.sln"
|
||||||
|
|
||||||
|
# Step 0: Update Local Repository
|
||||||
|
git pull
|
||||||
|
|
||||||
|
# Step 1: Restore NuGet Packages
|
||||||
|
Write-Host "Restoring NuGet packages..."
|
||||||
|
msbuild "$SolutionFile" /p:Configuration=Release /restore /t:PrepareForBuild
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "Failed to restore NuGet packages."
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 2: Build and Package
|
||||||
|
Write-Host "Building and packaging the solution..."
|
||||||
|
msbuild "$SolutionFile" /p:Configuration=Release /t:Rebuild /v:normal
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "Build failed."
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 3: Copy Installer Files
|
||||||
|
Write-Host "Copying installer files..."
|
||||||
|
if (-not (Test-Path $ArtifactsPath)) {
|
||||||
|
New-Item -ItemType Directory -Force -Path $ArtifactsPath
|
||||||
|
}
|
||||||
|
Copy-Item "$RepoPath\installer\Greenshot-INSTALLER-*.exe" -Destination $ArtifactsPath -Force
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "Failed to copy installer files."
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 4: Extract Version from File Name
|
||||||
|
Write-Host "Extracting version from installer file name..."
|
||||||
|
$InstallerFile = Get-ChildItem $ArtifactsPath -Filter "Greenshot-INSTALLER-*.exe" | Select-Object -Last 1
|
||||||
|
if (-not $InstallerFile) {
|
||||||
|
Write-Error "No matching installer file found in '$ArtifactsPath'."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($InstallerFile.Name -match "Greenshot-INSTALLER-([\d\.]+).*\.exe") {
|
||||||
|
$Version = $matches[1]
|
||||||
|
Write-Host "Extracted version: $Version"
|
||||||
|
} else {
|
||||||
|
Write-Error "Version number could not be extracted from file name: $($InstallerFile.Name)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 5: Create Git Tag
|
||||||
|
Write-Host "Creating Git tag..."
|
||||||
|
cd $RepoPath
|
||||||
|
#git config user.name "local-script"
|
||||||
|
#git config user.email "local-script@example.com"
|
||||||
|
git tag -a "v$Version" -m "v$Version"
|
||||||
|
git push origin "v$Version"
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "Failed to create Git tag."
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 6: Create GitHub Release
|
||||||
|
Write-Host "Creating GitHub release..."
|
||||||
|
$Headers = @{
|
||||||
|
Authorization = "Bearer $ReleaseToken"
|
||||||
|
Accept = "application/vnd.github+json"
|
||||||
|
}
|
||||||
|
$ReleaseData = @{
|
||||||
|
tag_name = "v$Version"
|
||||||
|
name = "Greenshot $Version unstable"
|
||||||
|
body = "Pre-release of Greenshot $Version."
|
||||||
|
draft = $true
|
||||||
|
prerelease = $true
|
||||||
|
generate_release_notes = $true
|
||||||
|
}
|
||||||
|
$ReleaseResponse = Invoke-RestMethod `
|
||||||
|
-Uri "https://api.github.com/repos/jklingen/greenshot/releases" `
|
||||||
|
-Method POST `
|
||||||
|
-Headers $Headers `
|
||||||
|
-Body (ConvertTo-Json $ReleaseData -Depth 10)
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "Failed to create GitHub release."
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Release created successfully."
|
||||||
|
|
||||||
|
# Get the release ID from the response
|
||||||
|
$ReleaseId = $ReleaseResponse.id
|
||||||
|
Write-Host "Release ID: $ReleaseId"
|
||||||
|
|
||||||
|
# Step 7: Upload .exe File to Release
|
||||||
|
Write-Host "Uploading .exe file to GitHub release..."
|
||||||
|
$ExeFilePath = "$ArtifactsPath\$($InstallerFile.Name)"
|
||||||
|
if (-Not (Test-Path $ExeFilePath)) {
|
||||||
|
Write-Error "Built .exe file not found: $ExeFilePath"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# GitHub API for uploading release assets
|
||||||
|
$UploadUrl = $ReleaseResponse.upload_url -replace "{.*}", ""
|
||||||
|
|
||||||
|
# Upload the file
|
||||||
|
$FileHeaders = @{
|
||||||
|
Authorization = "Bearer $ReleaseToken"
|
||||||
|
ContentType = "application/octet-stream"
|
||||||
|
}
|
||||||
|
$FileName = [System.IO.Path]::GetFileName($ExeFilePath)
|
||||||
|
|
||||||
|
Invoke-RestMethod `
|
||||||
|
-Uri "$($UploadUrl)?name=$FileName" `
|
||||||
|
-Method POST `
|
||||||
|
-Headers $FileHeaders `
|
||||||
|
-InFile $ExeFilePath `
|
||||||
|
-ContentType "application/octet-stream"
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "Failed to upload .exe file to release."
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "File uploaded successfully: $FileName"
|
||||||
|
|
||||||
|
# Step 7: Trigger GitHub Pages Rebuild
|
||||||
|
#Write-Host "Triggering GitHub Pages rebuild..."
|
||||||
|
#Invoke-RestMethod `
|
||||||
|
# -Uri "https://api.github.com/repos/jklingen/greenshot/pages/builds" `
|
||||||
|
# -Method POST `
|
||||||
|
# -Headers $Headers
|
||||||
|
#if ($LASTEXITCODE -ne 0) {
|
||||||
|
# Write-Error "Failed to trigger GitHub Pages rebuild."
|
||||||
|
# exit $LASTEXITCODE
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
#Write-Host "GitHub Pages rebuild triggered successfully."
|
|
@ -140,6 +140,7 @@ SetupIconFile=..\..\src\Greenshot\icons\applicationIcon\icon.ico
|
||||||
; SignTool=SignTool sign /debug /fd sha1 /tr https://time.certum.pl /td sha1 $f
|
; SignTool=SignTool sign /debug /fd sha1 /tr https://time.certum.pl /td sha1 $f
|
||||||
; Append a SHA256 to the previous SHA1 signature (this is what as does)
|
; Append a SHA256 to the previous SHA1 signature (this is what as does)
|
||||||
; SignTool=SignTool sign /debug /as /fd sha256 /tr https://time.certum.pl /td sha256 $f
|
; SignTool=SignTool sign /debug /as /fd sha256 /tr https://time.certum.pl /td sha256 $f
|
||||||
|
SignTool=SignTool sign /sha1 "{#GetEnv('CertumThumbprint')}" /tr http://time.certum.pl /td sha256 /fd sha256 /v $f
|
||||||
;SignedUninstaller=yes
|
;SignedUninstaller=yes
|
||||||
UninstallDisplayIcon={app}\{#ExeName}.exe
|
UninstallDisplayIcon={app}\{#ExeName}.exe
|
||||||
Uninstallable=true
|
Uninstallable=true
|
||||||
|
|
6
nuget.config
Normal file
6
nuget.config
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||||
|
</packageSources>
|
||||||
|
</configuration>
|
|
@ -1,13 +1,65 @@
|
||||||
<Project>
|
<Project>
|
||||||
|
<UsingTask TaskName="ApplyTokenReplacements" TaskFactory="CodeTaskFactory" AssemblyName="Microsoft.Build.Tasks.Core">
|
||||||
|
<ParameterGroup>
|
||||||
|
<InputLines ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
|
||||||
|
<Tokens ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
|
||||||
|
<OutputLines ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true" />
|
||||||
|
</ParameterGroup>
|
||||||
|
<Task>
|
||||||
|
<Reference Include="System.Text.RegularExpressions" />
|
||||||
|
<Code Type="Fragment" Language="cs">
|
||||||
|
<![CDATA[
|
||||||
|
var output = new List<ITaskItem>();
|
||||||
|
foreach (var line in InputLines)
|
||||||
|
{
|
||||||
|
string text = line.ItemSpec;
|
||||||
|
foreach (var token in Tokens)
|
||||||
|
{
|
||||||
|
string tokenName = token.ItemSpec;
|
||||||
|
// Skip if tokenName is null or empty
|
||||||
|
if (string.IsNullOrEmpty(tokenName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string replacementValue = token.GetMetadata("ReplacementValue");
|
||||||
|
if (!string.IsNullOrEmpty(replacementValue))
|
||||||
|
{
|
||||||
|
string placeholder = "$"+ "{"+tokenName+"}"; // Token-Format wie $(Box13_ClientId)
|
||||||
|
text = text.Replace(placeholder, replacementValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
output.Add(new Microsoft.Build.Utilities.TaskItem(text));
|
||||||
|
}
|
||||||
|
OutputLines = output.ToArray();
|
||||||
|
]]>
|
||||||
|
</Code>
|
||||||
|
</Task>
|
||||||
|
</UsingTask>
|
||||||
|
|
||||||
<PropertyGroup Condition="Exists('$(ProjectDir)$(ProjectName).Credentials.template')">
|
<PropertyGroup Condition="Exists('$(ProjectDir)$(ProjectName).Credentials.template')">
|
||||||
<MSBuildCommunityTasksPath>$(PkgMSBuildTasks)\tools\</MSBuildCommunityTasksPath>
|
<MSBuildCommunityTasksPath>$(NuGetPackageRoot)msbuildtasks/1.5.0.235/tools/</MSBuildCommunityTasksPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="$(MSBuildCommunityTasksPath)MSBuild.Community.Tasks.Targets" Condition="Exists('$(ProjectDir)$(ProjectName).Credentials.template')" />
|
<Import Project="$(MSBuildCommunityTasksPath)MSBuild.Community.Tasks.Targets" Condition="Exists('$(ProjectDir)$(ProjectName).Credentials.template')" />
|
||||||
|
|
||||||
<Target Name="ProcessTemplates" BeforeTargets="PrepareForBuild" Condition="Exists('$(ProjectDir)$(ProjectName).Credentials.template')">
|
<Target Name="ProcessTemplates" BeforeTargets="PrepareForBuild" Condition="Exists('$(ProjectDir)$(ProjectName).Credentials.template')">
|
||||||
<Message Text="Processing: $(ProjectDir)$(ProjectName).Credentials.template" Importance="high"/>
|
<Message Text="Processing: $(ProjectDir)$(ProjectName).Credentials.template" Importance="high"/>
|
||||||
<TemplateFile Template="$(ProjectDir)$(ProjectName).Credentials.template" OutputFilename="$(ProjectDir)$(ProjectName).Credentials.cs" Tokens="@(Tokens)" />
|
|
||||||
|
|
||||||
|
<ReadLinesFromFile File="$(ProjectDir)$(ProjectName).Credentials.template">
|
||||||
|
<Output TaskParameter="Lines" ItemName="TemplateLines" />
|
||||||
|
</ReadLinesFromFile>
|
||||||
|
|
||||||
|
<ApplyTokenReplacements InputLines="@(TemplateLines)" Tokens="@(Tokens)">
|
||||||
|
<Output TaskParameter="OutputLines" ItemName="ProcessedLines" />
|
||||||
|
</ApplyTokenReplacements>
|
||||||
|
|
||||||
|
<WriteLinesToFile
|
||||||
|
File="$(ProjectDir)$(ProjectName).Credentials.cs"
|
||||||
|
Lines="@(ProcessedLines)"
|
||||||
|
Overwrite="true" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ namespace Greenshot.Editor.Drawing
|
||||||
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
|
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
float fontSize = Math.Min(Math.Abs(Width), Math.Abs(Height)) / 1.4f;
|
float fontSize = Math.Min(Math.Abs(Width), Math.Abs(Height)) / 3f;
|
||||||
using FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name);
|
using FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name);
|
||||||
using Font font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel);
|
using Font font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel);
|
||||||
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, font);
|
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, font);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Greenshot - a free and open source screenshot tool
|
* Greenshot - a free and open source screenshot tool
|
||||||
* Copyright (C) 2007-2021 Thomas Braun, Jens Klingen, Robin Krom
|
* Copyright (C) 2007-2021 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace Greenshot.Plugin.Office;
|
namespace Greenshot.Plugin.Office
|
||||||
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A small utility class for helping with office
|
/// A small utility class for helping with office
|
||||||
|
@ -41,3 +42,4 @@ internal static class OfficeUtils
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.29728.190
|
VisualStudioVersion = 17.7.34009.444
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot", "Greenshot\Greenshot.csproj", "{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot", "Greenshot\Greenshot.csproj", "{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
@ -48,6 +48,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||||
..\azure-pipelines.yml = ..\azure-pipelines.yml
|
..\azure-pipelines.yml = ..\azure-pipelines.yml
|
||||||
Directory.Build.props = Directory.Build.props
|
Directory.Build.props = Directory.Build.props
|
||||||
Directory.Build.targets = Directory.Build.targets
|
Directory.Build.targets = Directory.Build.targets
|
||||||
|
..\.github\workflows\release.yml = ..\.github\workflows\release.yml
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Editor", "Greenshot.Editor\Greenshot.Editor.csproj", "{148D3C8B-D6EC-4A7D-80E9-243A81F19DD2}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Editor", "Greenshot.Editor\Greenshot.Editor.csproj", "{148D3C8B-D6EC-4A7D-80E9-243A81F19DD2}"
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.13.9" />
|
||||||
<PackageReference Include="Tools.InnoSetup" version="6.2.1" GeneratePathProperty="true" />
|
<PackageReference Include="Tools.InnoSetup" version="6.2.1" GeneratePathProperty="true" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -75,6 +76,7 @@
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||||
<SetEnvironmentVariableTask Name="BuildVersionSimple" Value="$(BuildVersionSimple)" />
|
<SetEnvironmentVariableTask Name="BuildVersionSimple" Value="$(BuildVersionSimple)" />
|
||||||
<SetEnvironmentVariableTask Name="AssemblyInformationalVersion" Value="$(AssemblyInformationalVersion)" />
|
<SetEnvironmentVariableTask Name="AssemblyInformationalVersion" Value="$(AssemblyInformationalVersion)" />
|
||||||
|
<Exec Command='signtool.exe sign /sha1 "$(CertumThumbprint)" /tr http://time.certum.pl /td sha256 /fd sha256 /v "$(OutDir)Greenshot.exe"' />
|
||||||
<Exec Command="$(PkgTools_InnoSetup)\tools\ISCC.exe $(SolutionDir)\..\installer\innosetup\setup.iss" />
|
<Exec Command="$(PkgTools_InnoSetup)\tools\ISCC.exe $(SolutionDir)\..\installer\innosetup\setup.iss" />
|
||||||
</Target>
|
</Target>
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue