Skip to content

Commit

Permalink
chore: automate packaging and release of playnite-web-plugin (#322)
Browse files Browse the repository at this point in the history
Fixes #321
  • Loading branch information
andrew-codes authored May 24, 2024
1 parent e69b846 commit 769fd2e
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 152 deletions.
101 changes: 53 additions & 48 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,51 +140,56 @@ jobs:
- name: Run all unit tests
run: yarn nx run-many --target=test/unit --parallel --verbose --projects=tag:windows

# package:
# name: Package extension
# runs-on: windows-latest
# permissions:
# packages: write
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 2
# - name: Add msbuild to PATH
# uses: microsoft/setup-msbuild@v2
# - 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: Prepare
# run: yarn nx run-many --target=prepare --parallel --all --verbose
# env:
# ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
# ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
# ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
# - name: Package extension
# run: yarn nx run playnite-web-plugin:package --verbose
# env:
# ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
# ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
# ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
# NODE_ENV: production
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: playnite-web-extension
# path: apps/*/_packaged/**
package:
name: Package extension
runs-on: windows-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- 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: Prepare
run: yarn nx run-many --target=prepare --parallel --all --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Package extension
run: yarn nx run playnite-web-plugin:package --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
NODE_ENV: production
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: playnite-web-extension
path: apps/*/_packaged/**
115 changes: 60 additions & 55 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,56 +105,61 @@ jobs:
NODE_ENV: production
TAG: ${{ steps.major_release_version.outputs.value }}-latest

# package:
# name: Publish Extension
# runs-on: windows-latest
# permissions:
# packages: write
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 2
# - name: Add msbuild to PATH
# uses: microsoft/setup-msbuild@v2
# - 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: Prepare
# run: yarn nx run-many --target=prepare --parallel --all --verbose
# env:
# ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
# ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
# ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
# - name: Package extension
# run: yarn nx run playnite-web-plugin:package --verbose
# env:
# ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
# ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
# ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
# NODE_ENV: production
# - name: Move artifacts
# run: mkdir -p _packaged && mv apps/*/_packaged/** _packaged/
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: playnite-extension
# path: _packaged/**
package:
name: Publish Extension
runs-on: windows-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- 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: Prepare
run: yarn nx run-many --target=prepare --parallel --all --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Package extension
run: yarn nx run playnite-web-plugin:package --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
NODE_ENV: production
- name: Move artifacts
run: mkdir -p _packaged && mv apps/*/_packaged/** _packaged/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: playnite-extension
path: _packaged/**

release:
name: Release
Expand All @@ -169,11 +174,11 @@ jobs:
with:
name: CHANGELOG
merge-multiple: true
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# name: playnite-extension
# merge-multiple: true
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: playnite-extension
merge-multiple: true
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
env:
Expand Down
101 changes: 53 additions & 48 deletions .github/workflows/pull-request-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,51 +143,56 @@ jobs:
- name: Run all unit tests
run: yarn nx run-many --target=test/unit --parallel --verbose --projects=tag:windows

# package:
# name: Package extension
# runs-on: windows-latest
# permissions:
# packages: write
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 2
# - name: Add msbuild to PATH
# uses: microsoft/setup-msbuild@v2
# - 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: Prepare
# run: yarn nx run-many --target=prepare --parallel --all --verbose
# env:
# ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
# ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
# ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
# - name: Package extension
# run: yarn nx run playnite-web-plugin:package --verbose
# env:
# ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
# ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
# ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
# NODE_ENV: production
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: playnite-extension
# path: apps/*/_packaged/**
package:
name: Package extension
runs-on: windows-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- 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: Prepare
run: yarn nx run-many --target=prepare --parallel --all --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Package extension
run: yarn nx run playnite-web-plugin:package --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
NODE_ENV: production
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: playnite-extension
path: apps/*/_packaged/**
2 changes: 1 addition & 1 deletion apps/PlayniteWebPlugin/scripts/package.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mkdir -p _packaged

../../libs/build-utils/playnite-toolbox/src/Toolbox/Toolbox.exe pack .dist/bin/Release/ _packaged
../../.tools/Playnite/Toolbox.exe pack .dist/bin/Release/ _packaged

0 comments on commit 769fd2e

Please sign in to comment.