Skip to content

Commit 3541a48

Browse files
committed
update ci.yml
1 parent d862684 commit 3541a48

2 files changed

Lines changed: 70 additions & 33 deletions

File tree

.github/workflows/ci.yml

Lines changed: 68 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -568,15 +568,15 @@ jobs:
568568
# ============================================================================
569569

570570
pr-preview:
571-
name: PR Preview Build
571+
name: Creator Hub Build
572572
strategy:
573+
fail-fast: true
573574
matrix:
574575
os: [ macos-latest, windows-latest ]
575576
runs-on: ${{ matrix.os }}
576-
needs: [ build ]
577-
if: github.event_name == 'pull_request'
578577
env:
579578
WORKING_DIRECTORY: packages/@dcl/creator-hub
579+
580580
steps:
581581
- uses: actions/checkout@v4
582582
with:
@@ -588,31 +588,26 @@ jobs:
588588
node-version: 22
589589
cache: 'npm'
590590

591-
- name: Install @dcl/inspector@branch package
592-
run: npm install "${{ secrets.SDK_TEAM_S3_BASE_URL }}/${{ needs.build.outputs.decentraland_inspector_s3_bucket_key }}"
593-
working-directory: ${{ env.WORKING_DIRECTORY }}
594-
env:
595-
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
596-
597-
- name: Install dependencies
598-
run: npm i --silent
591+
- name: 'Install dependencies'
592+
run: npm ci
599593
working-directory: ${{ env.WORKING_DIRECTORY }}
600594
env:
601595
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
602596

603-
- name: Build application (development mode)
604-
run: echo MODE=development && npm run build
597+
- name: 'Build'
598+
run: echo MODE=$MODE && npm run build
605599
working-directory: ${{ env.WORKING_DIRECTORY }}
606600
env:
607601
NODE_OPTIONS: "--max-old-space-size=8192"
608-
MODE: development
602+
MODE: ${{ !github.event.pull_request.number && 'production' || 'development' }}
609603
VITE_SEGMENT_CREATORS_HUB_API_KEY: ${{ secrets.VITE_SEGMENT_CREATORS_HUB_API_KEY }}
610604
VITE_SEGMENT_INSPECTOR_API_KEY: ${{ secrets.VITE_SEGMENT_INSPECTOR_API_KEY }}
611605
VITE_ALLOWED_EXTERNAL_ORIGINS: ${{ secrets.VITE_ALLOWED_EXTERNAL_ORIGINS }}
606+
# Sentry AUTH Token
612607
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
613608
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
614609

615-
- name: Generate preview version
610+
- name: Generate release version
616611
id: version
617612
uses: paulhatch/semantic-version@v5.4.0
618613
with:
@@ -624,47 +619,97 @@ jobs:
624619
bump_each_commit_patch_pattern: "/^(patch|fix).+/"
625620
search_commit_body: true
626621
user_format_type: "json"
622+
change_path: ${{ env.WORKING_DIRECTORY }}
627623

628-
- name: Build artifacts (no publishing)
629-
run: npx electron-builder --config electron-builder.cjs --config.extraMetadata.version=${{ steps.version.outputs.version }} --publish never
630-
working-directory: ${{ env.WORKING_DIRECTORY }}
624+
# Download 'SSLcom/esigner-codesign' to a folder called 'esigner-codesign' inside creator-hub package
625+
- name: Checkout esigner-codesign repository (Windows)
626+
if: ${{github.ref == 'refs/heads/main' && matrix.os == 'windows-latest' && !github.event.pull_request.number}}
627+
uses: actions/checkout@v3
628+
with:
629+
repository: 'SSLcom/esigner-codesign'
630+
path: ${{ env.WORKING_DIRECTORY }}/esigner-codesign
631+
632+
- name: Compile artifacts ${{ github.event.pull_request.number && ' ' || 'and upload them to github release' }}
633+
# I use this action because it is capable of retrying multiple times if there are any issues with the distribution server
634+
uses: nick-fields/retry@v3
635+
with:
636+
timeout_minutes: 60
637+
max_attempts: 6
638+
retry_wait_seconds: 15
639+
retry_on: error
640+
shell: 'bash'
641+
command: cd ${{ env.WORKING_DIRECTORY }} && npx electron-builder --config electron-builder.cjs --config.extraMetadata.version=${{ steps.version.outputs.version }} ${{ matrix.os == 'macos-latest' && format('--config.mac.notarize={0}', true) || '' }} --publish ${{ github.event.pull_request.number && 'never' || 'always' }}
631642
env:
643+
# Disable hard links to avoid issues with npm
632644
USE_HARD_LINKS: false
645+
# Code Signing params
646+
# See https://www.electron.build/code-signing
647+
CSC_LINK: ${{ secrets.MACOS_CSC_LINK }}
648+
CSC_KEY_PASSWORD: ${{ secrets.MACOS_CSC_KEY_PASSWORD }}
649+
# Notarization params
650+
# See https://www.electron.build/configuration/mac#NotarizeNotaryOptions
651+
APPLE_ID: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }}
652+
APPLE_TEAM_ID: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }}
653+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.MACOS_NOTARIZATION_PWD }}
654+
# Publishing artifacts
655+
GH_TOKEN: ${{ secrets.github_token }} # GitHub token, automatically provided (No need to define this secret in the repo settings)
656+
EP_PRE_RELEASE: true # Publish as pre-release
657+
# The following are the parameters required by the esigner-codesign action to work, we must explicitly pass in even the optional ones since we're not using the action directly, but from the checked out repo
658+
CODE_SIGN_SCRIPT_PATH: ${{ matrix.os == 'windows-latest' && format('{0}\\esigner-codesign\\dist\\index.js', github.workspace) || '' }}
659+
INPUT_COMMAND: "sign"
660+
INPUT_FILE_PATH: "${{ github.workspace }}\\dist\\Decentraland Creator Hub-${{ steps.version.outputs.version }}-win-x64.exe"
661+
INPUT_OVERRIDE: "true"
662+
INPUT_MALWARE_BLOCK: "false"
663+
INPUT_CLEAN_LOGS: "false"
664+
INPUT_JVM_MAX_MEMORY: "1024M"
665+
INPUT_ENVIRONMENT_NAME: "PROD"
666+
INPUT_USERNAME: ${{ secrets.ES_USERNAME }}
667+
INPUT_PASSWORD: ${{ secrets.ES_PASSWORD }}
668+
INPUT_TOTP_SECRET: ${{ secrets.ES_TOTP_SECRET }}
669+
INPUT_CREDENTIAL_ID: ${{ secrets.WINDOWS_CREDENTIAL_ID_SIGNER }}
633670

634671
- name: Move artifacts to upload folder
635-
run: sh -c 'mkdir dist/upload && cp dist/*.dmg dist/*.exe dist/upload 2> /dev/null || :'
672+
if: ${{ github.event.pull_request.number }}
636673
working-directory: ${{ env.WORKING_DIRECTORY }}
674+
run: sh -c 'mkdir dist/upload && cp dist/*.dmg dist/*.exe dist/upload 2> /dev/null || :'
637675

638676
- name: Upload to S3
677+
if: ${{ github.event.pull_request.number }}
639678
id: upload
679+
working-directory: ${{ env.WORKING_DIRECTORY }}
640680
env:
641681
AWS_ACCESS_KEY_ID: ${{ secrets.SDK_TEAM_AWS_ID }}
642682
AWS_SECRET_ACCESS_KEY: ${{ secrets.SDK_TEAM_AWS_SECRET }}
643683
run: |
644-
npx @dcl/cdn-uploader@next --bucket "${{ secrets.SDK_TEAM_S3_BUCKET }}" --local-folder "dist/upload" --bucket-folder "creator-hub/branch/${{ github.head_ref }}"
684+
npx @dcl/cdn-uploader@next \
685+
--bucket ${{ secrets.SDK_TEAM_S3_BUCKET }} \
686+
--local-folder dist/upload \
687+
--bucket-folder creator-hub/branch/${{ github.head_ref }}
645688
646689
- name: Set specific windows instructions
647690
if: ${{ github.event.pull_request.number && matrix.os == 'windows-latest' }}
648691
id: windows-instructions
692+
working-directory: ${{ env.WORKING_DIRECTORY }}
649693
run: |
650694
echo "list<<EOF" >> $GITHUB_ENV
651695
echo "[win-x64](${{ secrets.SDK_TEAM_S3_BASE_URL }}/creator-hub/branch/${{ github.head_ref }}/Decentraland%20Creator%20Hub-${{ steps.version.outputs.version }}-win-x64.exe)" >> $GITHUB_ENV
652696
echo "EOF" >> $GITHUB_ENV
653697
654-
- name: Set download instructions (macOS)
698+
- name: Set specific macos instructions
655699
if: ${{ github.event.pull_request.number && matrix.os == 'macos-latest' }}
656700
id: macos-instructions
701+
working-directory: ${{ env.WORKING_DIRECTORY }}
657702
run: |
658703
echo "list<<EOF" >> $GITHUB_ENV
659704
echo "[mac-x64](${{ secrets.SDK_TEAM_S3_BASE_URL }}/creator-hub/branch/${{ github.head_ref }}/Decentraland%20Creator%20Hub-${{ steps.version.outputs.version }}-mac-x64.dmg)" >> $GITHUB_ENV
660705
echo "[mac-arm64](${{ secrets.SDK_TEAM_S3_BASE_URL }}/creator-hub/branch/${{ github.head_ref }}/Decentraland%20Creator%20Hub-${{ steps.version.outputs.version }}-mac-arm64.dmg)" >> $GITHUB_ENV
661706
echo "EOF" >> $GITHUB_ENV
662-
content=$(cat ./.github/workflows/creator-hub-macos-instructions.md)
707+
content=$(cat ./.github/workflows/macos-instructions.md)
663708
echo "macos-instructions<<EOF" >> $GITHUB_ENV
664709
echo "$content" >> $GITHUB_ENV
665710
echo "EOF" >> $GITHUB_ENV
666711
667-
- name: Find existing comment
712+
- name: Find Comment
668713
if: ${{ github.event.pull_request.number }}
669714
uses: peter-evans/find-comment@v1
670715
id: fc

.github/workflows/creator-hub.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,8 @@ jobs:
105105
run: npm run test:renderer --if-present
106106
working-directory: ${{ env.WORKING_DIRECTORY }}
107107

108-
- name: Run E2E tests (Ubuntu)
109-
if: matrix.os == 'ubuntu-latest' && env.ENABLE_E2E_TESTS == 'true'
110-
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run build && npx vitest run
111-
working-directory: ${{ env.WORKING_DIRECTORY }}
112-
env:
113-
NODE_OPTIONS: "--max-old-space-size=8192"
114-
ENABLE_E2E_TESTS: true
115-
116-
- name: Run E2E tests (Non-Ubuntu)
117-
if: matrix.os != 'ubuntu-latest' && env.ENABLE_E2E_TESTS == 'true'
108+
- name: Run E2E tests
109+
if: env.ENABLE_E2E_TESTS == 'true'
118110
run: npm run build && npx vitest run
119111
working-directory: ${{ env.WORKING_DIRECTORY }}
120112
env:

0 commit comments

Comments
 (0)