-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added workflow for packages * Update packages 2023-03-20 * Update pkgs 2023-03-20 * Update pkgs 2023-03-21
- Loading branch information
Showing
4 changed files
with
121 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,38 @@ | ||
# Workflow that runs every day at 00:00 and checks for new packages | ||
name: Packages | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
push: | ||
branches: | ||
- nightly-packages | ||
|
||
jobs: | ||
check: | ||
runs-on: windows-latest | ||
steps: | ||
# Checkout branch nightly-packages | ||
- name: Checkout branch nightly-packages | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: nightly-packages | ||
# Checkout winget-pkgs | ||
- name: Checkout winget-pkgs | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: microsoft/winget-pkgs | ||
path: ./winget-pkgs | ||
# Run the script | ||
- name: Run the script | ||
run: | | ||
./updater.ps1 | ||
# Commit the changes | ||
- name: Commit the changes | ||
run: | | ||
git config --local user.email "eric@bostrot.com" | ||
git config --local user.name "Eric" | ||
git add pkgs.json | ||
git commit -m "Update pkgs $((Get-Date).ToString(`"yyyy-MM-dd`"))" | ||
git push | ||
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,41 @@ | ||
# Updates winget packages repository | ||
|
||
# Checkout repo https://github.com/microsoft/winget-pkgs/tree/master/manifests | ||
# git clone https://github.com/microsoft/winget-pkgs.git | ||
cd ./winget-pkgs/manifests | ||
|
||
# Create pkgs.json file with [ as first character | ||
"[" | Out-File -NoNewline -FilePath "../../pkgs.json" -Encoding UTF8 | ||
|
||
# For every folder (a-z) | ||
foreach ($folder in (Get-ChildItem -Path . -Directory)) { | ||
# For every company in the folder | ||
foreach ($company in (Get-ChildItem -Path $folder.FullName -Directory)) { | ||
# For every package in the company | ||
foreach ($package in (Get-ChildItem -Path $company.FullName -Directory)) { | ||
# For every version in the package | ||
$latestVersion = 0 | ||
foreach ($version in (Get-ChildItem -Path $package.FullName -Directory)) { | ||
# Check if version is greater than latest version with format 1.0.0.0 | ||
if ($version.Name -gt $latestVersion) { | ||
$latestVersion = $version.Name | ||
} | ||
} | ||
$packageName = $package.Name | ||
$companyName = $company.Name | ||
$versionName = $latestVersion | ||
|
||
# Append to pkgs.json without new line | ||
$packageString = "{`"name`":`"$packageName`",`"company`":`"$companyName`",`"version`":`"$versionName`"}," | ||
|
||
$packageString | Out-File -NoNewline -FilePath "../../pkgs.json" -Encoding UTF8 -Append | ||
|
||
# Write-Host "Added $packageName from $companyName with version $versionName" | ||
} | ||
} | ||
} | ||
|
||
# Write packages to file in json format | ||
"]" | Out-File -NoNewline -FilePath "../../pkgs.json" -Encoding UTF8 -Append | ||
|
||
cd ../../ |
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,41 @@ | ||
# # Updates winget packages repository | ||
|
||
# # Checkout repo https://github.com/microsoft/winget-pkgs/tree/master/manifests | ||
# # git clone https://github.com/microsoft/winget-pkgs.git | ||
|
||
#!/bin/bash | ||
cd ./winget-pkgs | ||
|
||
# Create pkgs.json file with [ as first character | ||
echo "[" > ./pkgs.json | ||
|
||
# For every folder (a-z) | ||
for folder in */; do | ||
# For every company in the folder | ||
for company in $folder*/; do | ||
# For every package in the company | ||
for package in $company*/; do | ||
# For every version in the package | ||
latestVersion=0 | ||
for version in $package*/; do | ||
# Check if version is greater than latest version with format | ||
if [[ $version > $latestVersion ]]; then | ||
latestVersion=$version | ||
fi | ||
done | ||
packageName=${package::-1} | ||
companyName=${company::-1} | ||
versionName=${latestVersion::-1} | ||
|
||
# Append to pkgs.json without new line | ||
packageString="{\"name\":\"$packageName\",\"company\":\"$companyName\",\"version\":\"$versionName\"}," | ||
|
||
echo $packageString >> ./pkgs.json | ||
done | ||
done | ||
done | ||
|
||
# Write packages to file in json format | ||
echo "]" >> ./pkgs.json | ||
|
||
cd ../ |