Skip to content

Merge pull request #20 from CNimmo16/changeset-release/main #71

Merge pull request #20 from CNimmo16/changeset-release/main

Merge pull request #20 from CNimmo16/changeset-release/main #71

Workflow file for this run

name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
npm:
name: Release to npm
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run ci:release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
outputs:
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
determine-client-version:
needs: npm
name: Determine client version
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
id: getPublishedPackages
env:
PUBLISHED_PACKAGES: ${{needs.npm.outputs.publishedPackages}}
with:
result-encoding: string
script: |
const publishedPackages = JSON.parse(process.env.PUBLISHED_PACKAGES);
const clientPackage = publishedPackages.find((pkg) => pkg.name === '@quory/client');
if (!clientPackage) {
return '';
}
console.info(`Found published client version: ${clientPackage.version}`);
return clientPackage.version;
outputs:
publishedClientVersion: ${{ steps.getPublishedPackages.outputs.result }}
electron:
needs: determine-client-version
if: needs.determine-client-version.outputs.publishedClientVersion != ''
name: Build and distribute Electron packages for Mac, Windows and Linux
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false # keep going with other operating systems if one fails
runs-on: ${{ matrix.os }}
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Build JS packages
run: npm run build
- name: Build Linux
if: matrix.os == 'ubuntu-latest'
run: npm --workspace @quory/client run build:linux
- name: Build Mac
if: matrix.os == 'macos-latest'
run: npm --workspace @quory/client run build:mac
- name: Build Windows
if: matrix.os == 'windows-latest'
run: npm --workspace @quory/client run build:win
- name: Upload to release
uses: softprops/action-gh-release@v1
with:
tag_name: '@quory/client@${{ needs.determine-client-version.outputs.publishedClientVersion }}'
append_body: true
make_latest: true
files: |
packages/client/dist/*.exe
packages/client/dist/*.zip
packages/client/dist/*.dmg
packages/client/dist/*.AppImage
packages/client/dist/*.snap
packages/client/dist/*.deb
packages/client/dist/*.rpm
packages/client/dist/*.tar.gz