Skip to content

Commit

Permalink
Initial auto-updater
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee committed Nov 3, 2021
1 parent 3cef825 commit 60a219c
Show file tree
Hide file tree
Showing 12 changed files with 706 additions and 11 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Update output.json

on:
schedule:
- cron: '31 5 * * *' # Once per day, random time
workflow_dispatch:

jobs:
update:
runs-on: ubuntu-latest
defaults:
run:
working-directory: './scripts/update'
steps:
- name: Checkout self
uses: actions/checkout@v2

- name: Checkout vcpkg
uses: actions/checkout@v2
with:
repository: 'microsoft/vcpkg'
path: 'vcpkg'

- uses: actions/setup-node@v2
with:
node-version: '16'

- run: npm ci

- run: npm run start $GITHUB_WORKSPACE/vcpkg

- uses: actions/upload-artifact@v2
with:
name: 'output.json'
path: './output.json'
18 changes: 12 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${file}"
"name": "Launch Updater",
"runtimeArgs": [
"--loader",
"ts-node/esm"
],
"args": [
"${workspaceFolder}/scripts/update/index.ts",
"${workspaceFolder}/vcpkg"
],
"env": {
"TS_NODE_PROJECT": "${workspaceFolder}/scripts/update/tsconfig.json"
}
}
]
}
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

18 changes: 18 additions & 0 deletions scripts/update/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as path from 'path';
import fs from 'fs-extra';
import { exit } from 'process';
import { addVersions } from './tasks/add-versions.js';
import { readPackages } from './tasks/read-packages.js';

if (!process.argv[2]) {
exit(-1);
}

const sourcePath = process.argv[2];
const portsPath = path.join(sourcePath, 'ports');
const versionsPath = path.join(sourcePath, 'versions');

const manifests = await readPackages(portsPath);
const manifests2 = await addVersions(versionsPath, manifests);

fs.writeJson('output.json', manifests2, { spaces: 2 });
Loading

0 comments on commit 60a219c

Please sign in to comment.