forked from chocolatey-community/chocolatey-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#1) Add basic pushing of packages to CCR
This commit adds some basic automation to pushing packages upstream to the Chocolatey Community Repository. This is done so it will be easier for us to push/update packages when we want without having to do a manual push.
- Loading branch information
1 parent
0a47a15
commit bbb438d
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Package Pusher | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
packages: | ||
description: "What is the packages you wish to push (seperate package names with a whitespace)?" | ||
required: true | ||
|
||
jobs: | ||
pusher: | ||
runs-on: windows-2019 | ||
env: | ||
github_user_repo: ${{ github.repository }} | ||
API_KEY: ${{ secrets.CHOCO_API_KEY }} | ||
SOURCE_LOCATION: "https://push.chocolatey.org" | ||
|
||
steps: | ||
- name: Install Dependencies | ||
run: | | ||
# Placeholder for installing dependencies | ||
# choco install chocolatey-core.extension -y | ||
shell: powershell | ||
- name: Environment Information | ||
run: | | ||
Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version | ||
$PSVersionTable | ||
choco --version | ||
shell: powershell | ||
- uses: actions/checkout@v3.0.0 | ||
- name: Pack Packages | ||
env: | ||
PACKAGE_PUSHES: ${{ github.event.inputs.packages }} | ||
run: | | ||
$packages = $env:PACKAGE_PUSHES -split ' ' | ||
Write-Host "Packing Packages:`n$packages" | ||
foreach ($package in $packages) { | ||
Write-Host ("{0}`n{1}`n" -f ('-'*60), "PACKAGE: $package") | ||
$package_dir = Get-ChildItem -Recurse | ? { $_.Name -eq "$package.nuspec" } | Select-Object -First 1 | % Directory | ||
if (!$package_dir) { Write-Warning "Can't find package '$package'"; continue } | ||
Push-Location $package_dir | ||
if (Test-Path update.ps1 -ea 0) { ./update.ps1 } | ||
choco pack | ||
Pop-Location | ||
} | ||
shell: powershell | ||
- name: Push Packages | ||
run: | | ||
$packages = Get-ChildItem -Recurse "*.nupkg" | ||
foreach ($package in $packages) { | ||
Write-Host ("- Pushing {0}" -f $package) | ||
choco push "$package" --source "${env:SOURCE_LOCATION}" --api-key "${env:API_KEY}" | ||
} | ||
shell: powershell |