Skip to content

fix: release depends on packaging of extension #32

fix: release depends on packaging of extension

fix: release depends on packaging of extension #32

name: Release a new version of Playnite-Web
on:
push:
tags:
- '*.*.*'
permissions:
contents: write
discussions: write
jobs:
changelog:
name: Generate changelog
needs: []
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
- name: Install changelog generator
run: |
gem install github_changelog_generator
- name: Generate changelog
env:
CHANGELOG_GITHUB_TOKEN: ${{ github.token }}
run: |
IFS='/' read -ra REPO_PARTS <<< "$GITHUB_REPOSITORY"
github_changelog_generator -u ${REPO_PARTS[0]} -p ${REPO_PARTS[1]}
- name: Upload changelog
uses: actions/upload-artifact@v4
with:
name: CHANGELOG
path: CHANGELOG.md
publish_images:
name: Publish apps
needs: []
permissions:
packages: write
env:
REGISTRY: ghcr.io
OWNER: andrew-codes
REPO_NAME: playnite-web
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Extract major release version from package.json
uses: sergeysova/jq-action@v2
id: major_release_version
with:
cmd: jq .version package.json -r | cut -d. -f1
- name: Extract node version from package.json
uses: sergeysova/jq-action@v2
id: node_version
with:
cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g'
- name: Extract yarn version from package.json
uses: sergeysova/jq-action@v2
id: yarn_version
with:
cmd: jq .engines.yarn package.json -r | sed -e 's/"//g'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Use Yarn
run: corepack enable && 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: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.OWNER }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish specific version for apps
run: yarn nx run-many --target=publish --parallel --verbose --all
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
NODE_ENV: production
TAG: ${{ github.ref_name }}
- name: Publish latest major version for apps
run: yarn nx run-many --target=publish --parallel --verbose --all
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
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: 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
needs: [publish_images, package, changelog]
permissions:
contents: write
discussions: write
runs-on: ubuntu-latest
steps:
- name: Download changelog
uses: actions/download-artifact@v4
with:
name: CHANGELOG
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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: CHANGELOG.md
discussion_category_name: announcements
files: |
*.*