Initial release #1
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 publishe, created or edited | |
# 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: | |
types: [created, edited, published] | |
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] | |
strategy: | |
matrix: | |
setting: [home, clinic] | |
os: [windows-latest, macOS-latest, ubuntu-latest] | |
fail-fast: true # A failed build will not end the other matrix jobs | |
steps: | |
# Set up Node | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
# 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: ⚒ Run 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') | |
run: npm run package:mac | |
- name: 📦 Package app installer - Linux | |
if: startsWith(matrix.os, 'ubuntu') | |
run: npm run package:linux | |
# Upload installers to github release | |
# TODO: Can these be combined based on matrix.os??? | |
- name: Set package version and name | |
uses: brown-ccv/gh-actions/get-package-info@main | |
id: package_info | |
- 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.package_name }}-${{ steps.package_info.outputs.package_version }} Setup.exe | |
asset_name: ${{ steps.package_info.outputs.package_name }}-${{ steps.package_info.outputs.package_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.package_name }}-${{ steps.package_info.outputs.package_version }}-x64.dmg | |
asset_name: ${{ steps.package_info.outputs.package_name }}-${{ steps.package_info.outputs.package_version }}-${{ matrix.setting }}.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.package_name }}_${{ steps.package_info.outputs.package_version }}_amd64.deb | |
asset_name: ${{ steps.package_info.outputs.package_name }}_${{ steps.package_info.outputs.package_version }}_${{ matrix.setting }}_amd64.deb | |
tag: ${{ github.ref }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-gh-pages: | |
name: Deploy to GH Pages | |
runs-on: ubuntu-latest | |
steps: | |
# Set up Node | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
# Install dependencies | |
- name: 📥 Install Dependencies | |
run: npm ci | |
# Build the app | |
- name: ⚒ Run 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 Node | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
# Install dependencies | |
- name: 📥 Install Dependencies | |
run: npm ci | |
# Build the app | |
- name: ⚒ Run Build | |
run: npm run build | |
# Package on PsiTurk | |
- name: Set package version and name | |
uses: brown-ccv/gh-actions/get-package-info@main | |
id: package_info | |
- name: 🐍 Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: 📥 Install PsiTurk | |
run: pip install psiturk | |
- name: 📦 Create Psiturk Build | |
run: | | |
cd psiturkit | |
./psiturk-it -p ${{ steps.package_info.outputs.package_name }}-psiturk | |
- name: ⬆ Upload PsiTurk Build | |
uses: actions/upload-artifact@v2 | |
with: | |
name: psiturk-build | |
path: psiturkit/${{ steps.package_info.outputs.package_name }}-psiturk |