Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codes committed Aug 12, 2024
1 parent 09f294d commit e7a4956
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 62 deletions.
97 changes: 51 additions & 46 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,51 +217,6 @@ jobs:
- name: Run all unit tests
run: yarn nx run-many --target=test/unit --parallel --verbose --projects=tag:windows

package_windows:
name: Package Windows projects
runs-on: windows-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Download Playnite Toolbox
run: |-
mkdir -p .tools/Playnite && curl "${{ secrets.PLAYNITE_TOOLBOX_URL }}" -o Playnite.zip && unzip Playnite.zip -d .tools/Playnite
- name: Install jq
run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
- name: Read Node version
run: echo "value=$(./jq.exe -r .engines.node package.json | sed -e 's/>=//g' | sed -e 's/"//g')" >> $GITHUB_OUTPUT
shell: bash
id: node_version
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Read Yarn version
run: echo "value=$(./jq.exe -r .engines.yarn package.json | sed -e 's/"//g')" >> $GITHUB_OUTPUT
shell: bash
id: yarn_version
- name: Enable yarn
run: corepack enable
- run: corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }}
- name: Install deps
run: yarn
- name: Run Version
run: yarn nx run-many --target=version --exclude='*,!tag:windows'
env:
NODE_ENV: production
- name: Package projects
run: yarn nx run-many --target=package --exclude='*,!tag:windows'
env:
NODE_ENV: production
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: playnite-web-extension
path: apps/*/_packaged/**

publish_release:
name: Publish release
needs:
Expand All @@ -270,7 +225,6 @@ jobs:
- component_tests_linux
- visual_component_tests_linux
- e2e_tests_linux
- package_windows
env:
REGISTRY: ghcr.io
OWNER: andrew-codes
Expand Down Expand Up @@ -332,3 +286,54 @@ jobs:
DEBUG: 'playnite-web/*'
PLATFORM: linux/amd64,linux/arm64
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXCLUDE: '*,!tag:linux'
INCLUDE_GH_RELEASE: 'true'

publish_windows_package:
name: Package Windows projects
runs-on: windows-latest
needs:
- publish_release
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Download Playnite Toolbox
run: |-
mkdir -p .tools/Playnite && curl "${{ secrets.PLAYNITE_TOOLBOX_URL }}" -o Playnite.zip && unzip Playnite.zip -d .tools/Playnite
- name: Install jq
run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
- name: Read Node version
run: echo "value=$(./jq.exe -r .engines.node package.json | sed -e 's/>=//g' | sed -e 's/"//g')" >> $GITHUB_OUTPUT
shell: bash
id: node_version
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Read Yarn version
run: echo "value=$(./jq.exe -r .engines.yarn package.json | sed -e 's/"//g')" >> $GITHUB_OUTPUT
shell: bash
id: yarn_version
- name: Enable yarn
run: corepack enable
- run: corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }}
- name: Install deps
run: yarn
- name: Run Version
run: yarn nx run-many --target=version --exclude='*,!tag:windows'
env:
NODE_ENV: production
- name: Package projects
run: yarn nx run-many --target=package --exclude='*,!tag:windows'
env:
NODE_ENV: production
- name: Semantic Release
run: yarn dlx semantic-release
env:
NODE_ENV: production
DEBUG: 'playnite-web/*'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXCLUDE: '*,!tag:windows'
3 changes: 2 additions & 1 deletion apps/PlayniteWebPlugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"publish": {
"executor": "nx:run-commands",
"options": {
"command": "ls -a . && gh release upload $VERSION _packaged/**/*.pext"
"command": "ls -a _packaged && gh release upload $VERSION _packaged/*.pext",
"cwd": "{projectRoot}"
}
},
"version": {
Expand Down
33 changes: 18 additions & 15 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const exclude = process.env.EXCLUDE ? `--exclude='${process.env.EXCLUDE}'` : ''

const config = {
dryRun: false,
branches: ['main', 'next'],
Expand Down Expand Up @@ -52,24 +54,25 @@ const config = {
[
'@semantic-release/exec',
{
verifyReleaseCmd:
"yarn cross-env VERSION='${nextRelease.version}' yarn nx run-many --target=version --all",
publishCmd:
"yarn cross-env VERSION='${nextRelease.version}' PUBLISH='true' yarn nx run-many --target=publish",
},
],
[
'@semantic-release/github',
{
assets: [
{
path: '_packaged/**/*.*',
label: 'Playnite Web Plugin',
},
],
verifyReleaseCmd: `yarn cross-env VERSION='${nextRelease.version}' yarn nx run-many --target=version ${exclude}`,
publishCmd: `yarn cross-env VERSION='${nextRelease.version}' PUBLISH='true' yarn nx run-many --target=publish ${exclude}`,
},
],
],
}

if (process.env.INCLUDE_GH_RELEASE === 'true') {
config.plugins.push([
'@semantic-release/github',
{
assets: [
{
path: '_packaged/**/*.*',
label: 'Playnite Web Plugin',
},
],
},
])
}

module.exports = config

0 comments on commit e7a4956

Please sign in to comment.