Skip to content

Add settings control base #950

Add settings control base

Add settings control base #950

Workflow file for this run

name: CI
on: push
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
runs-on: windows-latest
name: Build and Test
env:
CONFIGURATION: Release
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
- name: Restore Dependencies
run: |
dotnet tool install -g dotnet-version-cli
dotnet restore
# dotnet version --dry-run -f src/Common.props --build-meta { git rev-parse --short HEAD }
- run: dotnet build -c $env:CONFIGURATION
- run: dotnet build -c $env:CONFIGURATION src\HolzShots\HolzShots.csproj
- run: dotnet test -c $env:CONFIGURATION --no-build src\HolzShots.Core.Tests\HolzShots.Core.Tests.csproj
- run: npm install -g ajv-cli
# - name: Validate JSON Schemas
# run: |
# curl -o json-schema.json https://json-schema.org/draft/2019-09/schema
# ajv -s json-schema.json -d src/schema/*.schema.json
- name: Collect Artifacts
if: startsWith(github.ref, 'refs/tags/v')
run: |
7z a HolzShots.zip ".\src\HolzShots\bin\$env:CONFIGURATION\net9.0-windows\win-x64\*.exe"
7z a HolzShots.zip ".\src\HolzShots\bin\$env:CONFIGURATION\net9.0-windows\win-x64\*.dll"
7z a HolzShots.zip ".\src\HolzShots\bin\$env:CONFIGURATION\net9.0-windows\win-x64\*.config"
7z a HolzShots.zip ".\src\HolzShots\bin\$env:CONFIGURATION\net9.0-windows\win-x64\*.manifest"
sha256sum HolzShots.zip > sha256sums.txt
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: HolzShots.zip
path: HolzShots.zip
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: sha256sums.txt
path: sha256sums.txt
release:
runs-on: windows-latest
needs: [build]
name: Publish Release
if: startsWith(github.ref, 'refs/tags/v')
env:
CONFIGURATION: Release
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: HolzShots.zip
path: .
- uses: actions/download-artifact@v4
with:
name: sha256sums.txt
path: .
- name: Perpare Version Data
shell: bash
run: |
RELEASE_VERSION=${GITHUB_REF#refs/tags/v}
RELEASE_YEAR=`date +"%Y"`
RELEASE_HASH=`grep -ohiE "^[0-9a-z]+" sha256sums.txt`
echo "version=${RELEASE_VERSION}" >> $GITHUB_OUTPUT
echo "year=${RELEASE_YEAR}" >> $GITHUB_OUTPUT
echo "checksum=${RELEASE_HASH}" >> $GITHUB_OUTPUT
sed -i -e "s/__REPLACE_YEAR__/${RELEASE_YEAR}/g" package/holzshots.nuspec
sed -i -e "s/__REPLACE_VERSION__/${RELEASE_VERSION}/g" package/holzshots.nuspec
sed -i -e "s/__REPLACE_VERSION__/${RELEASE_VERSION}/g" package/tools/chocolateyinstall.ps1
sed -i -e "s/__REPLACE_CHECKSUM__/${RELEASE_HASH}/g" package/tools/chocolateyinstall.ps1
- name: Bundle Chocolatey Package
uses: crazy-max/[email protected]
with:
args: pack --out . ./package/holzshots.nuspec
# https://github.com/actions/upload-artifact/issues/11#issuecomment-568101677
- id: get_choco_package
shell: bash
run: echo "file=$(ls holzshots*.nupkg)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: holzshots.nupkg
path: ${{ steps.get_choco_package.outputs.file }}
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset HolzShots.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./HolzShots.zip
asset_name: HolzShots.zip
asset_content_type: application/zip
- name: Upload Release Asset sha256sums.txt
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sha256sums.txt
asset_name: sha256sums.txt
asset_content_type: text/plain
- name: Upload Release Asset Chocolatey-Package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.get_choco_package.outputs.file }}
asset_name: ${{ steps.get_choco_package.outputs.file }}
asset_content_type: application/zip
- name: Publish Chocolatey Package to Community Feed
shell: bash
run: |
choco push ${{ steps.get_choco_package.outputs.file }} --source "https://push.chocolatey.org/" -k="${{ secrets.CHOCO_API_KEY }}"