Merge pull request #18 from CNimmo16/changeset-release/main #57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- name: Install Dependencies | |
run: npm install | |
- 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 | |
env: | |
PUBLISHED_PACKAGES: ${{needs.npm.outputs.publishedPackages}} | |
with: | |
script: | | |
const publishedPackages = JSON.parse(process.env.PUBLISHED_PACKAGES); | |
const clientPackage = publishedPackages.find((pkg) => pkg.name === '@quory/client'); | |
if (!clientPackage) { | |
return null; | |
} | |
console.info(`Found published client version: ${clientPackage.version}`); | |
return clientPackage.version; | |
electron: | |
needs: determine-client-version | |
if: needs.determine-client-version.outputs.result | |
name: Build and distribute Electron packages for Mac, Windows and Linux | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install Dependencies | |
run: npm install | |
- name: build-linux | |
if: matrix.os == 'ubuntu-latest' | |
run: npm run build:linux | |
- name: build-mac | |
if: matrix.os == 'macos-latest' | |
run: npm run build:mac | |
- name: build-win | |
if: matrix.os == 'windows-latest' | |
run: npm run build:win | |
- name: upload to release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
tag_name: ${{ needs.determine-client-version.outputs.publishedClientVersion }} | |
files: | | |
dist/*.exe | |
dist/*.zip | |
dist/*.dmg | |
dist/*.AppImage | |
dist/*.snap | |
dist/*.deb | |
dist/*.rpm | |
dist/*.tar.gz | |
dist/*.yml | |
dist/*.blockmap |