Skip to content

Build Choco package & Publish #31

Build Choco package & Publish

Build Choco package & Publish #31

on:
workflow_dispatch:
inputs:
publish:
description: Whether to publish or not the package on chocolatey
required: false
type: boolean
default: false
name: Build Choco package & Publish
jobs:
build-windows:
runs-on: windows-latest
name: Build chocolatey package
defaults:
run:
shell: pwsh
working-directory: chocolatey
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Update Package
run: |
$res=.\update.ps1
Add-Content -Path $env:GITHUB_ENV -Value "CHOCO_UPDATE=$($res.Updated | ConvertTo-Json)"
Add-Content -Path $env:GITHUB_ENV -Value "CHOCO_NEW_VERSION=$($res.NewVersion | ConvertTo-Json)"
- name: Test package
run: |
choco install --no-progress quarto -source .
choco uninstall -y quarto
- name: Commit Updated Spec
if: ${{ fromJSON(env.CHOCO_UPDATE) }}
run: |
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am 'New quarto version ${{ fromJSON(env.CHOCO_NEW_VERSION) }}' || echo "No changes to commit"
git push origin || echo "No changes to commit"
- name: Publish Choco Package
env:
CHOCO_KEY: ${{ secrets.CHOCO_KEY }}
if: ${{ inputs.publish }}
run: |
echo "deploying to chocolatey"
choco apikey --key $Env:CHOCO_KEY --source https://push.chocolatey.org/
choco push --source https://push.chocolatey.org/