Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
lancejpollard committed Jan 23, 2024
1 parent a1435b6 commit a17ba66
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/choco.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,46 @@ jobs:
# Windows Server 2022 (https://github.com/actions/runner-images)
runs-on: windows-2022
environment: build
if: $(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -Fqx choco.json && echo "true") == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set CHOCO_CHANGED
run: echo "CHOCO_CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -Fqx choco.json && echo \"true\")" >> $env:GITHUB_ENV
- name: Create cache directory
if: env.CHOCO_CHANGED == 'true'
run: mkdir "$($env:LOCALAPPDATA)\choco-cache"
- name: Cache Tools
if: env.CHOCO_CHANGED == 'true'
uses: actions/cache@v4
with:
path: "$($env:LOCALAPPDATA)\\choco-cache"
key: ${{ runner.os }}-temp-cache
- name: Set Choco cache path
if: env.CHOCO_CHANGED == 'true'
run: choco config set cacheLocation "$($env:LOCALAPPDATA)\choco-cache"
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.10.x
- name: Set ENV vars
if: env.CHOCO_CHANGED == 'true'
id: version
run: |
echo "PACKAGE_VERSION=$(node -p "require('./choco.json').version")" >> $env:GITHUB_ENV
echo "PACKAGE_VERSION=$(cat choco.json | jq -r '.version')" >> $env:GITHUB_ENV
- name: Choco pack
if: env.CHOCO_CHANGED == 'true'
run: |
choco pack load/choco/task.nuspec --out load/choco
- name: Choco install
if: env.CHOCO_CHANGED == 'true'
run: |
choco install -y task --source "'./load/choco;chocolatey'"
- name: Choco set api key
if: env.CHOCO_CHANGED == 'true'
env:
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
run:
choco apikey --key $env:CHOCOLATEY_API_KEY --source https://push.chocolatey.org/
- name: Choco publish
if: env.CHOCO_CHANGED == 'true'
env:
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
run:
Expand Down

0 comments on commit a17ba66

Please sign in to comment.