-
Notifications
You must be signed in to change notification settings - Fork 236
101 lines (98 loc) · 3.41 KB
/
ci-cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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
- windows-latest
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
environment:
name: ${{ matrix.os }}
env:
SCRATCH_SHOULD_SIGN: ${{ github.ref_name == 'main' }}
AC_USERNAME: ${{ github.ref_name == 'main' && secrets.AC_USERNAME }}
AC_PASSWORD: ${{ github.ref_name == 'main' && secrets.AC_PASSWORD }}
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
- name: Install Python 2.7
if: matrix.os == 'macos-latest'
run: |
brew install pyenv
pyenv install 2.7.18
- name: Setup Keys for Fastlane
if: matrix.os == 'macos-latest'
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.FASTLANE_ACCESS_KEY }}
- name: Fastlane
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'
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 }}
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' }}
- name: Zip MAS-Dev build
if: matrix.os == 'macos-latest' && env.SCRATCH_SHOULD_SIGN == 'true'
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
uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: macOS
path: |
dist/Scratch*.dmg
dist/mas/Scratch*.pkg
dist/mas-dev-*.zip
- name: Upload Windows artifacts
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: Windows
path: |
dist/Scratch*.appx
dist/Scratch*.exe