Skip to content

Update Package Manifests #1127

Update Package Manifests

Update Package Manifests #1127

# Update package App.json
name: Update Package Manifests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
workflow_dispatch:
push:
branches: ["main"]
paths:
- "scripts/Update-PackageJson.ps1"
- "**/App.json"
schedule:
- cron: '15 2 * * *'
jobs:
update-json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install and cache PowerShell modules
id: psmodulecache
uses: potatoqualitee/[email protected]
with:
modules-to-cache: "Evergreen::, VcRedist::"
updatable: true
shell: pwsh
- name: List Modules
id: list-modules
shell: pwsh
run: |
foreach ($module in @("Evergreen", "VcRedist")) {
$Version = (Get-Module -Name $module -ListAvailable | Select-Object -First 1).Version.ToString()
Write-Host "$module version: $Version"
}
- name: Update package JSON
id: update-json
shell: pwsh
run: |
$params = @{
Path = "${{ github.workspace }}"
PackageFolder = "packages"
PackageManifest = "App.json"
InstallManifest = "Install.json"
Verbose = $false
}
. "${{ github.workspace }}/scripts/Update-PackageJson.ps1" @params
# Format the date number for the commit message
- name: Get date
id: get-date
shell: pwsh
run: |
echo "::set-output name=date::$(Get-Date -Format "yyyy.MM.dd")"
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPGKEY }}
passphrase: ${{ secrets.GPGPASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_config_global: true
git_tag_gpgsign: true
git_push_gpgsign: false
git_committer_name: ${{ secrets.COMMIT_NAME }}
git_committer_email: ${{ secrets.COMMIT_EMAIL }}
- name: Commit changes
id: commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update json ${{ steps.get-date.outputs.date }}.${{ github.run_number }} ${{ github.job }}"
commit_user_name: ${{ secrets.COMMIT_NAME }}
commit_user_email: ${{ secrets.COMMIT_EMAIL }}
- name: "Run if changes have been detected"
if: steps.commit.outputs.changes_detected == 'true'
run: echo "Changes committed."
- name: "Run if no changes have been detected"
if: steps.commit.outputs.changes_detected == 'false'
run: echo "No changes detected."