-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 1.55 KB
/
build-and-publish-choco.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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@v3
- 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/