Skip to content

Commit

Permalink
version in package.json for each project is the source of truth
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codes committed Jun 1, 2024
1 parent 4ea5114 commit 9a8311e
Show file tree
Hide file tree
Showing 30 changed files with 544 additions and 66 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: 'Publish nightly'
name: 'Publish latest major- and minor-versions'

on:
push:
branches:
- main
- release-*

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-release-closed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
account-type: personal
keep-at-least: 0
token: ${{ secrets.PACKAGE_PRUNER_TOKEN }}
filter-tags: 'PR${{ github.event.pull_request.number }}'
filter-tags: 'PR-${{ github.event.pull_request.number }}'
1 change: 1 addition & 0 deletions .github/workflows/pull-request-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: 'Verify Pull Request'
on:
pull_request:
branches:
- main
- release-*

permissions:
Expand Down
198 changes: 189 additions & 9 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file modified .yarn/install-state.gz
Binary file not shown.
8 changes: 7 additions & 1 deletion apps/PlayniteWebPlugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
"version": "3.1.0",
"private": true,
"devDependencies": {
"@types/shelljs": "^0.8.15",
"cpy": "^11.0.0",
"cpy-cli": "^5.0.0",
"esbuild": "^0.17.3",
"esbuild-register": "^3.4.2",
"nx": "^19.1.1",
"prettier": "^3.1.1",
"rimraf": "^5.0.5"
"rimraf": "^5.0.5",
"shelljs": "^0.8.5",
"typescript": "^5.3.2",
"versioning": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion apps/PlayniteWebPlugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"executor": "nx:run-commands",
"outputs": ["{projectRoot}/.dist"],
"options": {
"command": "msbuild PlayniteWeb.csproj -property:Configuration=Release",
"command": "yarn node --require esbuild-register ./scripts/build.js",
"cwd": "{projectRoot}/src"
}
},
Expand Down
27 changes: 27 additions & 0 deletions apps/PlayniteWebPlugin/scripts/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import fs from 'fs/promises'
import path from 'path'
import sh from 'shelljs'
import pkg from '../package.json'

async function run() {
const projectRoot = path.join(__dirname, '../')
process.chdir(projectRoot)

await fs.writeFile(
path.join(projectRoot, 'extension.yaml'),
`
Id: PlayniteWeb_ec3439e3-51ee-43cb-9a8a-5d82cf45edac
Name: Playnite Web
Author: Andrew Smith
Module: PlayniteWeb.dll
Type: GenericPlugin
Icon: Resources\\icon.png
Version: ${pkg.version}
`,
'utf8',
)

sh.exec(`msbuild PlayniteWeb.csproj -property:Configuration=Release`)
}

run()
7 changes: 0 additions & 7 deletions apps/PlayniteWebPlugin/src/extension.yaml

This file was deleted.

7 changes: 5 additions & 2 deletions apps/game-db-updater/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "game-db-updater",
"description": "Service to listen to MQTT messages and update game database.",
"version": "3.1.0",
"version": "3.1.4",
"private": true,
"dependencies": {
"async-mqtt": "^2.6.3",
Expand All @@ -13,6 +13,7 @@
"devDependencies": {
"@types/jest": "^29.2.5",
"@types/node": "^18.11.18",
"@types/shelljs": "^0.8.15",
"cpy": "^11.0.0",
"cpy-cli": "^5.0.0",
"dotenv": "^16.3.1",
Expand All @@ -25,7 +26,9 @@
"nx": "^19.1.1",
"prettier": "^3.1.1",
"rimraf": "^5.0.5",
"shelljs": "^0.8.5",
"ts-jest": "^29.0.5",
"typescript": "^5.3.2"
"typescript": "^5.3.2",
"versioning": "workspace:*"
}
}
6 changes: 2 additions & 4 deletions apps/game-db-updater/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@
"package": {
"executor": "nx:run-commands",
"options": {
"commands": ["cp -R .dist/ _packaged/"],
"commands": ["yarn node --require=esbuild-register scripts/package.js"],
"cwd": "{projectRoot}"
}
},
"publish": {
"executor": "nx:run-commands",
"options": {
"commands": [
"docker build --tag $REGISTRY/$OWNER/$REPO_NAME-game-db-updater:$TAG --file Dockerfile . && docker push $REGISTRY/$OWNER/$REPO_NAME-game-db-updater:$TAG"
],
"commands": ["yarn node --require=esbuild-register scripts/publish.js"],
"cwd": "{projectRoot}"
}
},
Expand Down
8 changes: 0 additions & 8 deletions apps/game-db-updater/scripts/package.sh

This file was deleted.

27 changes: 27 additions & 0 deletions apps/game-db-updater/scripts/package.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import path from 'path'
import sh from 'shelljs'
import { getDockerTags } from 'versioning'
import pkg from '../package.json'

async function run() {
const projectRoot = path.join(__dirname, '../')
process.chdir(projectRoot)

sh.cp('-R', '.dist/', '_packaged/')

const { REGISTRY, OWNER, GITHUB_REF } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
}

let tags = await getDockerTags(pkg.version, GITHUB_REF)

for (const tag of tags) {
sh.exec(
`docker build --tag "${REGISTRY}/${OWNER}/playnite-web-game-db-updater:${tag}" -file Dockerfile .`,
)
}
}

run()
7 changes: 0 additions & 7 deletions apps/game-db-updater/scripts/publish.sh

This file was deleted.

21 changes: 21 additions & 0 deletions apps/game-db-updater/scripts/publish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import sh from 'shelljs'
import { getDockerTags } from 'versioning'
import pkg from '../package.json'

async function run() {
const { REGISTRY, OWNER, GITHUB_REF } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
}

let tags = await getDockerTags(pkg.version, GITHUB_REF)

for (const tag of tags) {
sh.exec(
`docker push "${REGISTRY}/${OWNER}/playnite-web-game-db-updater:${tag}"`,
)
}
}

run()
10 changes: 8 additions & 2 deletions apps/gh-action-runner/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"name": "gh-action-runner",
"version": "3.1.0",
"version": "3.1.4",
"sideEffects": false,
"devDependencies": {
"@types/shelljs": "^0.8.15",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"esbuild": "^0.17.3",
"esbuild-register": "^3.4.2",
"glob": "^10.3.10",
"nx": "19.1.1",
"rimraf": "^5.0.5",
"typescript": "^5.3.2"
"shelljs": "^0.8.5",
"ts-jest": "^29.0.5",
"typescript": "^5.3.2",
"versioning": "workspace:*"
}
}
6 changes: 4 additions & 2 deletions apps/gh-action-runner/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
"package": {
"executor": "nx:run-commands",
"options": {
"commands": ["bash -c '. ./scripts/package.sh'"],
"commands": [
"yarn node --register esbuild-register scripts/package.js"
],
"cwd": "{projectRoot}"
}
},
"publish": {
"executor": "nx:run-commands",
"options": {
"commands": [
"docker build --tag $REGISTRY/$OWNER/$REPO_NAME-app:$TAG --file Dockerfile ../.. && docker push $REGISTRY/$OWNER/$REPO_NAME-app:$TAG"
"yarn node --register esbuild-register scripts/publish.js"
],
"cwd": "{projectRoot}"
}
Expand Down
7 changes: 0 additions & 7 deletions apps/gh-action-runner/scripts/package.sh

This file was deleted.

25 changes: 25 additions & 0 deletions apps/gh-action-runner/scripts/package.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import path from 'path'
import sh from 'shelljs'
import { getDockerTags } from 'versioning'
import pkg from '../package.json'

async function run() {
const projectRoot = path.join(__dirname, '../')
process.chdir(projectRoot)

const { REGISTRY, OWNER, GITHUB_REF } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
}

let tags = await getDockerTags(pkg.version, GITHUB_REF)

for (const tag of tags) {
sh.exec(
`docker build --tag "${REGISTRY}/${OWNER}/playnite-gh-action-runner:${tag}" -file Dockerfile .`,
)
}
}

run()
7 changes: 0 additions & 7 deletions apps/gh-action-runner/scripts/publish.sh

This file was deleted.

21 changes: 21 additions & 0 deletions apps/gh-action-runner/scripts/publish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import sh from 'shelljs'
import { getDockerTags } from 'versioning'
import pkg from '../package.json'

async function run() {
const { REGISTRY, OWNER, GITHUB_REF } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
}

let tags = await getDockerTags(pkg.version, GITHUB_REF)

for (const tag of tags) {
sh.exec(
`docker push "${REGISTRY}/${OWNER}/playnite-web-gh-action-runner:${tag}"`,
)
}
}

run()
8 changes: 7 additions & 1 deletion apps/playnite-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,26 @@
"@types/node": "^18.11.18",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/shelljs": "^0.8.15",
"@types/styled-components": "^5.1.34",
"babel-plugin-direct-import": "^1.0.0",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"cypress": "^13.6.1",
"esbuild": "^0.17.3",
"esbuild-register": "^3.4.2",
"glob": "^10.3.10",
"npm-run-all": "^4.1.5",
"nx": "19.1.1",
"prettier": "^3.1.1",
"remix-esbuild-override": "^3.1.0",
"remix-pwa": "^3.0.19",
"rimraf": "^5.0.5",
"shelljs": "^0.8.5",
"ts-jest": "^29.0.5",
"typescript": "^5.3.2",
"typescript-remix-routes-plugin": "^1.0.1"
"typescript-remix-routes-plugin": "^1.0.1",
"versioning": "workspace:*"
},
"scripts": {
"postinstall": "yarn remix-esbuild-override"
Expand Down
30 changes: 30 additions & 0 deletions apps/playnite-web/scripts/package.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import path from 'path'
import sh from 'shelljs'
import { getDockerTags } from 'versioning'
import pkg from '../package.json'

async function run() {
const projectRoot = path.join(__dirname, '../')
process.chdir(projectRoot)

sh.cp('-R', 'build/', '_packaged/')
sh.cp('-R', 'public/', '_packaged/')
sh.cp('-R', 'server.mjs/', '_packaged')
sh.cp('-R', 'package.json', '_packaged')

const { REGISTRY, OWNER, GITHUB_REF } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
}

let tags = await getDockerTags(pkg.version, GITHUB_REF)

for (const tag of tags) {
sh.exec(
`docker build --tag "${REGISTRY}/${OWNER}/playnite-web-app:${tag}" -file Dockerfile .`,
)
}
}

run()
19 changes: 19 additions & 0 deletions apps/playnite-web/scripts/publish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import sh from 'shelljs'
import { getDockerTags } from 'versioning'
import pkg from '../package.json'

async function run() {
const { REGISTRY, OWNER, GITHUB_REF } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
}

let tags = await getDockerTags(pkg.version, GITHUB_REF)

for (const tag of tags) {
sh.exec(`docker push "${REGISTRY}/${OWNER}/playnite-web-app:${tag}"`)
}
}

run()
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.1.4",
"packages": ["apps/*", "libs/**/*"],
"packages": ["apps/*"],
"npmClient": "yarn"
}
Loading

0 comments on commit 9a8311e

Please sign in to comment.