2023-11-03 19:24:14 -04:00
|
|
|
name: CI/CD
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write # publish a GitHub release
|
|
|
|
pages: write # deploy to GitHub Pages
|
|
|
|
issues: write # comment on released issues
|
|
|
|
pull-requests: write # comment on released pull requests
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
ci-cd:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- macos-latest
|
2023-11-30 08:30:43 -05:00
|
|
|
- windows-latest
|
2023-11-03 19:24:14 -04:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
environment:
|
|
|
|
name: ${{ matrix.os }}
|
2023-11-15 14:10:29 -05:00
|
|
|
env:
|
2023-11-30 11:04:35 -05:00
|
|
|
SCRATCH_SHOULD_SIGN: ${{ github.ref_name == 'main' }}
|
2023-11-29 10:28:06 -05:00
|
|
|
AC_USERNAME: ${{ github.ref_name == 'main' && secrets.AC_USERNAME }}
|
|
|
|
AC_PASSWORD: ${{ github.ref_name == 'main' && secrets.AC_PASSWORD }}
|
2023-11-03 19:24:14 -04:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
cache: 'npm'
|
|
|
|
node-version-file: '.nvmrc'
|
|
|
|
- name: Debug info
|
|
|
|
run: |
|
|
|
|
cat <<EOF
|
|
|
|
Node version: $(node --version)
|
|
|
|
NPM version: $(npm --version)
|
|
|
|
GitHub ref: ${{ github.ref }}
|
|
|
|
GitHub head ref: ${{ github.head_ref }}
|
|
|
|
Working directory: $(pwd)
|
|
|
|
EOF
|
|
|
|
- name: Install NPM dependencies
|
|
|
|
run: npm ci
|
|
|
|
- name: Test
|
|
|
|
run: npm run test
|
2023-11-16 12:50:03 -05:00
|
|
|
- name: Install Python 2.7
|
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
run: |
|
|
|
|
brew install pyenv
|
|
|
|
pyenv install 2.7.18
|
2023-11-15 14:10:29 -05:00
|
|
|
- name: Setup Keys for Fastlane
|
2023-11-16 12:50:03 -05:00
|
|
|
if: matrix.os == 'macos-latest'
|
2023-11-15 14:10:29 -05:00
|
|
|
uses: webfactory/ssh-agent@v0.7.0
|
|
|
|
with:
|
2023-12-05 14:26:51 -05:00
|
|
|
ssh-private-key: ${{ secrets.FASTLANE_ACCESS_KEY }}
|
2023-11-03 19:24:14 -04:00
|
|
|
- name: Fastlane
|
2023-11-29 14:17:27 -05:00
|
|
|
env:
|
|
|
|
GIT_URL: ${{ secrets.FL_GIT_URL }}
|
|
|
|
STORAGE_MODE: ${{secrets.FL_STORAGE_MODE}}
|
|
|
|
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
|
|
|
|
if: matrix.os == 'macos-latest' && env.SCRATCH_SHOULD_SIGN == 'true'
|
2023-11-03 19:24:14 -04:00
|
|
|
run: fastlane circleci
|
|
|
|
- name: Build
|
|
|
|
timeout-minutes: 30 # macOS notarization can take a while
|
|
|
|
env:
|
|
|
|
# TODO: fix whatever is causing excessive memory usage during build
|
|
|
|
NODE_OPTIONS: --max-old-space-size=4096
|
|
|
|
# These will be blank on macOS and on unsigned builds
|
|
|
|
# macOS CSC info was set by Fastlane above
|
|
|
|
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
|
|
|
|
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
|
2023-11-29 10:28:06 -05:00
|
|
|
PYTHON_PATH: ${{ matrix.os == 'macos-latest' && '/Users/runner/.pyenv/versions/2.7.18/bin/python'}}
|
|
|
|
run: npm run ${{ env.SCRATCH_SHOULD_SIGN == true && 'dist' || 'distDev' }}
|
2023-11-03 19:24:14 -04:00
|
|
|
- name: Zip MAS-Dev build
|
2023-11-29 14:17:27 -05:00
|
|
|
if: matrix.os == 'macos-latest' && env.SCRATCH_SHOULD_SIGN == 'true'
|
2023-11-03 19:24:14 -04:00
|
|
|
run: |
|
|
|
|
NPM_APP_VERSION="`node -pe "require('./package.json').version"`"
|
|
|
|
cd dist/mas-dev
|
|
|
|
ditto -v -c -k --sequesterRsrc --keepParent --zlibCompressionLevel 9 \
|
|
|
|
Scratch*.app ../mas-dev-${NPM_APP_VERSION}.zip
|
|
|
|
- name: Upload macOS artifacts
|
2023-11-16 12:50:03 -05:00
|
|
|
uses: actions/upload-artifact@v3
|
2023-11-03 19:24:14 -04:00
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
with:
|
|
|
|
name: macOS
|
|
|
|
path: |
|
|
|
|
dist/Scratch*.dmg
|
|
|
|
dist/mas/Scratch*.pkg
|
|
|
|
dist/mas-dev-*.zip
|
|
|
|
- name: Upload Windows artifacts
|
2023-11-28 11:53:15 -05:00
|
|
|
uses: actions/upload-artifact@v3
|
2023-11-03 19:24:14 -04:00
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
with:
|
|
|
|
name: Windows
|
|
|
|
path: |
|
|
|
|
dist/Scratch*.appx
|
|
|
|
dist/Scratch*.exe
|