Skip to content

Commit

Permalink
Merged Pull Request '#33 nightly-package-update->main : Add nightly-p…
Browse files Browse the repository at this point in the history
…ackage-update workflow'

Add nightly-package-update workflow
  • Loading branch information
Automation51D authored Nov 28, 2023
2 parents c0d74d7 + e801b82 commit 589f647
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/nightly-package-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Nightly Package Update

on:
workflow_dispatch:
inputs:
dryrun:
default: false
type: boolean
description: Dry Run
schedule:
- cron: '0 1 * * *'

jobs:
Nightly_Package_Update:
uses: 51Degrees/common-ci/.github/workflows/nightly-package-update.yml@main
with:
repo-name: ${{ github.event.repository.name }}
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/nightly-prs-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ on:
default: false
type: boolean
description: Dry Run
schedule:
- cron: '0 1 * * *'
workflow_run:
workflows: [Nightly Package Update]
types: [completed]

jobs:
Nightly_PRs_to_Main:
Expand Down
19 changes: 19 additions & 0 deletions ci/update-packages.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
param (
[Parameter(Mandatory=$true)]
[string]$RepoName,
[Parameter(Mandatory=$true)]
[string]$OrgName,
[bool]$DryRun = $false
)

Write-Output "Downloading latest javascript-templates..."
Invoke-WebRequest "https://github.com/$OrgName/javascript-templates/archive/refs/heads/main.zip" -OutFile javascript-templates.zip

Write-Output "Extracting the archive..."
Expand-Archive javascript-templates.zip -DestinationPath .

Write-Output "Updating the package directory..."
Move-Item -Path javascript-templates-main/*.mustache -Destination $RepoName/javascript-templates -Force

Write-Output "Cleaning up..."
Remove-Item javascript-templates.zip, javascript-templates-main -Recurse

0 comments on commit 589f647

Please sign in to comment.