Skip to content

Commit

Permalink
ci: revert to original workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGemmaJr committed Jun 13, 2024
1 parent 9645310 commit edd7f15
Showing 1 changed file with 87 additions and 219 deletions.
306 changes: 87 additions & 219 deletions .github/workflows/workflow-package.yml
Original file line number Diff line number Diff line change
@@ -1,122 +1,3 @@
# name: 📦 Package Workflow

# # Workflow dispatch for packaging an electron executable
# on:
# workflow_dispatch:
# inputs:
# setting:
# type: choice
# options:
# - "home"
# - "clinic"
# default: "home"
# required: true
# description: Package the app for 'home' or 'clinic' use
# os:
# type: choice
# description: Which operating system to make executables for
# required: true
# default: "All"
# options:
# - "All"
# - "Windows"
# - "macOS"
# - "Linux"
# jobs:
# package-and-upload:
# name: Package and Upload
# runs-on: ${{ matrix.os }}

# # Run action for [home/clinic] in [windows/macOS/ubuntu] based on user input
# strategy:
# matrix:
# # TODO: There's got to be a better way to handle this?
# os: ${{
# (github.event.inputs.os == 'All' && fromJSON('["ubuntu-latest", "macOS-13", "windows-latest"]')) ||
# (github.event.inputs.os == 'Windows' && fromJSON('["windows-latest"]')) ||
# (github.event.inputs.os == 'macOS' && fromJSON('["macOS-13"]')) ||
# (github.event.inputs.os == 'Linux' && fromJSON('["ubuntu-latest"]')) }}
# fail-fast: false # A failed build will not end the other matrix jobs

# steps:
# # Set up runner
# - name: ⬇️ Checkout repo
# uses: actions/checkout@v4

# - name: ⎔ Setup node
# uses: actions/setup-node@v4
# with:
# node-version-file: .nvmrc
# cache: npm
# - name: 🐍 Setup Python
# uses: actions/setup-python@v4
# with:
# python-version: 3.12

# # Install dependencies and set up environment
# - name: 🅿️ Install Python tools
# run: pip install setuptools
# - name: 📥 Install Dependencies
# run: npm ci

# # TEMP
# - name: Test - electron rebuild
# run: npx electron-rebuild

# # Set up the environment
# - name: 🔃 Load .env file (.env.${{github.event.inputs.setting}})
# uses: xom9ikk/dotenv@v2
# with:
# path: ./env
# mode: ${{github.event.inputs.setting}}

# # Package the app and make the installers
# - name: 📦 Make app installer - Windows
# if: startsWith(matrix.os, 'windows')
# run: npm run make:windows
# - name: 📦 Make app installer - Mac
# if: startsWith(matrix.os, 'mac')
# run: npm run make:mac
# - name: 📦 Make app installer - Linux
# if: startsWith(matrix.os, 'ubuntu')
# run: npm run make:linux

# # 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

# - run: ls ./out/make
# shell: bash

# # Upload installers to github action
# # TODO @brown-ccv #247: Can we use the publish command here?
# - name: ⬆ Upload installer - Windows
# uses: actions/upload-artifact@v3
# if: startsWith(matrix.os, 'windows')
# with:
# name: ${{ format('win-installer-{0}', github.event.inputs.setting) }}
# path: out/make/squirrel.windows/x64/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }} Setup.exe
# if-no-files-found: error

# - name: ⬆ Upload installer - Mac
# uses: actions/upload-artifact@v3
# if: startsWith(matrix.os, 'mac')
# with:
# name: ${{ format('mac-installer-{0}', github.event.inputs.setting) }}
# path: out/make/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-universal.dmg
# if-no-files-found: error
# - name: ⬆ Upload installer - Linux
# uses: actions/upload-artifact@v3
# if: startsWith(matrix.os, 'ubuntu')
# with:
# name: ${{ format('linux-installer-{0}', github.event.inputs.setting) }}
# path: out/make/deb/x64/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_amd64.deb
# if-no-files-found: error

name: 📦 Package Workflow

# Workflow dispatch for packaging an electron executable
Expand All @@ -141,110 +22,97 @@ on:
- "Windows"
- "macOS"
- "Linux"
# jobs:
# package-and-upload:
# name: Package and Upload
# runs-on: ${{ matrix.os }}

# strategy:
# matrix:
# include:
# - os: ubuntu-latest
# if: github.event.inputs.os == 'All' || github.event.inputs.os == 'Linux'
# # run: npm run make:linux
# # upload_path: out/make/deb/x64/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_amd64.deb
# # upload_name: linux-installer-${{ github.event.inputs.setting }}
# - os: macOS-13
# # run: npm run make:mac
# # upload_path: out/make/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-universal.dmg
# # upload_name: mac-installer-${{ github.event.inputs.setting }}
# - os: windows-latest
# # run: npm run make:windows
# # upload_path: out/make/squirrel.windows/x64/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }} Setup.exe
# # upload_name: win-installer-${{ github.event.inputs.setting }}
# # exclude:
# # - os: ubuntu-latest
# # if: github.event.inputs.os != 'All' || github.event.inputs.os != 'Linux'
# # - os: macOS-13
# # if: github.event.inputs.os != 'All' || github.event.inputs.os != 'macOS'
# # - os: windows-latest
# # if: github.event.inputs.os != 'All' || github.event.inputs.os != 'Windows'

# steps:
# - name: ⬇️ Checkout repo
# uses: actions/checkout@v4

# - name: ⎔ Setup node
# uses: actions/setup-node@v4
# with:
# node-version-file: .nvmrc
# cache: npm

# - name: 🐍 Setup Python
# uses: actions/setup-python@v4
# with:
# python-version: 3.12

# - name: 🅿️ Install Python tools
# run: pip install setuptools

# - name: 📥 Install Dependencies
# run: npm ci

# - name: 🔃 Load .env file (.env.${{ github.event.inputs.setting }})
# uses: xom9ikk/dotenv@v2
# with:
# path: ./env
# mode: ${{ github.event.inputs.setting }}

# - run: echo ${{ matrix.os }}
# shell: bash

# - name: 📦 Make app installer
# run: npm run make

# # TODO: Can I handle this before the
# - 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

# - run: ls ./out/make
# shell: bash

# - name: NEW - Get package name and version
# id: new_package_info
# run: |
# PACKAGE_NAME=$(node -p "require('./package.json').name")
# PACKAGE_VERSION=$(node -p "require('./package.json').version")
# echo "Package Name: $PACKAGE_NAME"
# echo "Package Version: $PACKAGE_VERSION"
# shell: bash

# # TODO: This will be based on the package name and version
# # - name: ⬆ Upload installer
# # uses: actions/upload-artifact@v3
# # with:
# # name: ${{ matrix.upload_name }}
# # path: ${{ matrix.upload_path }}
# # if-no-files-found: error

jobs:
test:
package-and-upload:
name: Package and Upload
runs-on: ${{ matrix.os }}

# Run action for [home/clinic] in [windows/macOS/ubuntu] based on user input
strategy:
matrix:
os:
- name: "ubuntu-latest"
exclude: ${{ github.event.inputs.os != 'All' && github.event.inputs.os != 'Linux' }}
- name: "macOS-latest"
exclude: ${{ github.event.inputs.os != 'All' && github.event.inputs.os != 'macOS' }}
- name: "windows-latest"
exclude: ${{ github.event.inputs.os != 'All' && github.event.inputs.os != 'Windows' }}
# TODO: There's got to be a better way to handle this?
os: ${{
(github.event.inputs.os == 'All' && fromJSON('["ubuntu-latest", "macOS-13", "windows-latest"]')) ||
(github.event.inputs.os == 'Windows' && fromJSON('["windows-latest"]')) ||
(github.event.inputs.os == 'macOS' && fromJSON('["macOS-13"]')) ||
(github.event.inputs.os == 'Linux' && fromJSON('["ubuntu-latest"]')) }}
fail-fast: false # A failed build will not end the other matrix jobs

steps:
- name: Example Step
run: echo "Running on ${{ runner.os }}"
# Set up runner
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12

# Install dependencies and set up environment
- name: 🅿️ Install Python tools
run: pip install setuptools
- name: 📥 Install Dependencies
run: npm ci

# TEMP
- name: Test - electron rebuild
run: npx electron-rebuild

# Set up the environment
- name: 🔃 Load .env file (.env.${{github.event.inputs.setting}})
uses: xom9ikk/dotenv@v2
with:
path: ./env
mode: ${{github.event.inputs.setting}}

# Package the app and make the installers
- name: 📦 Make app installer - Windows
if: startsWith(matrix.os, 'windows')
run: npm run make:windows
- name: 📦 Make app installer - Mac
if: startsWith(matrix.os, 'mac')
run: npm run make:mac
- name: 📦 Make app installer - Linux
if: startsWith(matrix.os, 'ubuntu')
run: npm run make:linux

# 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

- run: ls ./out/make
shell: bash

# Upload installers to github action
# TODO @brown-ccv #247: Can we use the publish command here?
- name: ⬆ Upload installer - Windows
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'windows')
with:
name: ${{ format('win-installer-{0}', github.event.inputs.setting) }}
path: out/make/squirrel.windows/x64/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }} Setup.exe
if-no-files-found: error

- name: ⬆ Upload installer - Mac
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'mac')
with:
name: ${{ format('mac-installer-{0}', github.event.inputs.setting) }}
path: out/make/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-universal.dmg
if-no-files-found: error
- name: ⬆ Upload installer - Linux
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: ${{ format('linux-installer-{0}', github.event.inputs.setting) }}
path: out/make/deb/x64/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_amd64.deb
if-no-files-found: error

0 comments on commit edd7f15

Please sign in to comment.