Skip to content

Commit d2f11a8

Browse files
author
Ron de las Alas
authored
Merge pull request #341 from scratchfoundation/gha
Migrate scratch-desktop to GitHub Actions
2 parents af8bde6 + ae5bc31 commit d2f11a8

File tree

6 files changed

+111
-218
lines changed

6 files changed

+111
-218
lines changed

.circleci/config.yml

Lines changed: 0 additions & 216 deletions
This file was deleted.

.github/workflows/ci-cd.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: CI/CD
2+
on:
3+
push:
4+
5+
concurrency:
6+
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
7+
8+
permissions:
9+
contents: write # publish a GitHub release
10+
pages: write # deploy to GitHub Pages
11+
issues: write # comment on released issues
12+
pull-requests: write # comment on released pull requests
13+
14+
jobs:
15+
ci-cd:
16+
strategy:
17+
matrix:
18+
os:
19+
- macos-latest
20+
- windows-latest
21+
runs-on: ${{ matrix.os }}
22+
defaults:
23+
run:
24+
shell: bash
25+
environment:
26+
name: ${{ matrix.os }}
27+
env:
28+
SCRATCH_SHOULD_SIGN: ${{ github.ref_name == 'main' }}
29+
AC_USERNAME: ${{ github.ref_name == 'main' && secrets.AC_USERNAME }}
30+
AC_PASSWORD: ${{ github.ref_name == 'main' && secrets.AC_PASSWORD }}
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-node@v3
34+
with:
35+
cache: 'npm'
36+
node-version-file: '.nvmrc'
37+
- name: Debug info
38+
run: |
39+
cat <<EOF
40+
Node version: $(node --version)
41+
NPM version: $(npm --version)
42+
GitHub ref: ${{ github.ref }}
43+
GitHub head ref: ${{ github.head_ref }}
44+
Working directory: $(pwd)
45+
EOF
46+
- name: Install NPM dependencies
47+
run: npm ci
48+
- name: Test
49+
run: npm run test
50+
- name: Install Python 2.7
51+
if: matrix.os == 'macos-latest'
52+
run: |
53+
brew install pyenv
54+
pyenv install 2.7.18
55+
- name: Setup Keys for Fastlane
56+
if: matrix.os == 'macos-latest'
57+
uses: webfactory/[email protected]
58+
with:
59+
ssh-private-key: ${{ secrets.FASTLANE_DEPLOY_KEY }}
60+
- name: Fastlane
61+
env:
62+
GIT_URL: ${{ secrets.FL_GIT_URL }}
63+
STORAGE_MODE: ${{secrets.FL_STORAGE_MODE}}
64+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
65+
if: matrix.os == 'macos-latest' && env.SCRATCH_SHOULD_SIGN == 'true'
66+
run: fastlane circleci
67+
- name: Build
68+
timeout-minutes: 30 # macOS notarization can take a while
69+
env:
70+
# TODO: fix whatever is causing excessive memory usage during build
71+
NODE_OPTIONS: --max-old-space-size=4096
72+
# These will be blank on macOS and on unsigned builds
73+
# macOS CSC info was set by Fastlane above
74+
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
75+
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
76+
PYTHON_PATH: ${{ matrix.os == 'macos-latest' && '/Users/runner/.pyenv/versions/2.7.18/bin/python'}}
77+
run: npm run ${{ env.SCRATCH_SHOULD_SIGN == true && 'dist' || 'distDev' }}
78+
- name: Zip MAS-Dev build
79+
if: matrix.os == 'macos-latest' && env.SCRATCH_SHOULD_SIGN == 'true'
80+
run: |
81+
NPM_APP_VERSION="`node -pe "require('./package.json').version"`"
82+
cd dist/mas-dev
83+
ditto -v -c -k --sequesterRsrc --keepParent --zlibCompressionLevel 9 \
84+
Scratch*.app ../mas-dev-${NPM_APP_VERSION}.zip
85+
- name: Upload macOS artifacts
86+
uses: actions/upload-artifact@v3
87+
if: matrix.os == 'macos-latest'
88+
with:
89+
name: macOS
90+
path: |
91+
dist/Scratch*.dmg
92+
dist/mas/Scratch*.pkg
93+
dist/mas-dev-*.zip
94+
- name: Upload Windows artifacts
95+
uses: actions/upload-artifact@v3
96+
if: matrix.os == 'windows-latest'
97+
with:
98+
name: Windows
99+
path: |
100+
dist/Scratch*.appx
101+
dist/Scratch*.exe

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ npm-*
2727
/locale
2828

2929
# Fastlane
30-
**/fastlane/Matchfile
30+
## **/fastlane/Matchfile
3131
**/fastlane/report.xml
3232
**/fastlane/Preview.html
3333
**/fastlane/screenshots

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16

fastlane/Matchfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
git_url(ENV.fetch("GIT_URL"))
2+
storage_mode(ENV.fetch("STORAGE_MODE"))
3+
type("development") # The default type, can be: appstore, adhoc, enterprise or development
4+
# app_identifier(["tools.fastlane.app", "tools.fastlane.app2"])
5+
# username("[email protected]") # Your Apple Developer Portal username
6+
app_identifier("edu.mit.scratch.scratch-desktop") # The bundle identifier of your app
7+
username("[email protected]") # Your Apple email address

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"repository": {
2424
"type": "git",
25-
"url": "git+ssh://[email protected]/LLK/scratch-desktop.git"
25+
"url": "git+ssh://[email protected]/scratchfoundation/scratch-desktop.git"
2626
},
2727
"dependencies": {
2828
"source-map-support": "^0.5.19"

0 commit comments

Comments
 (0)