v3.3.0-beta.1 #71
Workflow file for this run
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 | |
# Runs the build and package scripts when a new tagged release is created | |
# Note that this runs for both releases and pre-releases: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release | |
on: | |
release: | |
# TODO @brown-ccv: I need to figure out which ones to do here? | |
# TODO @brown-ccv: Should occur whenever a release is created or edited, prelease or otherwise | |
# types: created | |
types: [created, edited, prereleased] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
jobs: | |
package-and-upload: | |
name: Package and Upload | |
runs-on: ${{ matrix.os }} | |
# Run build script for [home/clinic] in [windows/macOS/ubuntu]+ | |
# TODO @brown-ccv: Split OS as seperate jobs with matrix for just the build environments | |
strategy: | |
matrix: | |
setting: [home, clinic] | |
os: [windows-latest, macOS-latest, ubuntu-latest] | |
fail-fast: true | |
steps: | |
# Set up runner | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: 🐍 Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
# Install dependencies and set up environment | |
- name: 📥 Install Dependencies | |
run: npm ci | |
- name: 🔃 Load .env file (.env.${{matrix.setting}}) | |
uses: xom9ikk/dotenv@v2 | |
with: | |
path: ./env | |
mode: ${{matrix.setting}} | |
# Build the app | |
- name: ⚒ Build | |
run: npm run build | |
# Package the app installers | |
- name: 📦 Package app installer - Windows | |
if: startsWith(matrix.os, 'windows') | |
run: npm run package:windows | |
- name: 📦 Package app installer - Mac | |
if: startsWith(matrix.os, 'mac') | |
# TODO @brown-ccv #318: Universal may not work between Intel and Apple Silicon? | |
# TODO @brown-ccv #318: Will have to run seperate makes for `arm64` and `x64` | |
run: npm run package:mac | |
- name: 📦 Package app installer - Linux | |
if: startsWith(matrix.os, 'ubuntu') | |
run: npm run package:linux | |
# TEMP | |
# TODO: Delete | |
- name: "LS Directory" | |
run: ls -R out/ | |
# Get package info | |
- name: Get package name and version | |
id: package_info | |
run: | | |
echo "name=$(cat package.json | jq -r '.name')" >> $GITHUB_OUTPUT | |
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT | |
shell: bash | |
# Upload installers to github release | |
- name: ⬆ Upload installer to release - Windows | |
if: startsWith(matrix.os, 'windows') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: out/make/squirrel.windows/x64/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }} Setup.exe | |
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-setup.exe | |
tag: ${{ github.ref }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: ⬆ Upload installer to release - macOS | |
if: startsWith(matrix.os, 'mac') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: out/make/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-x64.dmg | |
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-universal.dmg | |
tag: ${{ github.ref }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: ⬆ Upload installer to release - Linux | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: out/make/deb/x64/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_amd64.deb | |
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-amd64.deb | |
tag: ${{ github.ref }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
# TODO @brown-ccv: This should only run on "latest-release" tag on main | |
deploy-gh-pages: | |
name: Deploy to GH Pages | |
runs-on: ubuntu-latest | |
steps: | |
# Set up runner | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: 🐍 Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
# Install dependencies | |
- name: 📥 Install Dependencies | |
run: npm ci | |
# Build the app | |
- name: ⚒ Build | |
run: npm run build | |
# Deploy the app to GitHub Pages | |
- name: 🚀 Deploy to GH Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build | |
package-psiturk: | |
name: Package for PsiTurk | |
runs-on: ubuntu-latest | |
steps: | |
# Set up runner | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: 🐍 Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
# Install dependencies | |
- name: 📥 Install Dependencies | |
run: npm ci | |
- name: 📥 Install PsiTurk | |
run: pip install psiturk | |
# Build the app | |
- name: ⚒ Build | |
run: npm run build | |
# Get package info | |
- name: Get package name and version | |
id: package_info | |
run: | | |
echo "name=$(cat package.json | jq -r '.name')" >> $GITHUB_OUTPUT | |
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT | |
shell: bash | |
# Package with PsiTurk | |
- name: 📦 Create Psiturk Build | |
run: | | |
cd psiturkit | |
./psiturk-it -p ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk | |
# Zip and upload the package | |
- name: Zip psiturk folder | |
run: | | |
cd psiturkit | |
zip -r ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk.zip ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk | |
- name: ⬆ Upload PsiTurk Build | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: psiturkit/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk.zip | |
tag: ${{ github.ref }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} |