Update Electron 31.6.0 #161
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build pull request artifacts | |
on: | |
pull_request: | |
branches: | |
- master | |
- develop | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
if: contains(github.event.pull_request.labels.*.name, 'build-artifacts') | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Disable git core.autocrlf | |
run: git config --global core.autocrlf false | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node 20.14.0 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.14.0' | |
- name: Setup node_modules cache | |
uses: actions/cache@v4 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install package dependencies | |
run: yarn install | |
- name: Lint | |
run: yarn lint | |
- name: Test | |
run: yarn test | |
- name: Build app/ | |
run: yarn build | |
env: | |
NODE_ENV: production | |
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }} | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
- name: Build Windows Package | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: yarn electron-builder --publish never --x64 --win nsis | |
env: | |
CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} | |
- name: Build MacOS Package | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: | | |
sudo mdutil -a -i off | |
yarn electron-builder --publish never --mac --universal | |
env: | |
CSC_LINK: ${{ secrets.MAC_CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }} | |
CSC_FOR_PULL_REQUEST: true | |
FORCE_NOTARIZE: true | |
APPLEID: ${{ secrets.APPLEID }} | |
APPLEIDPASS: ${{ secrets.APPLEIDPASS }} | |
ASC_PROVIDER: 'S6UPZG7ZR3' | |
- name: Build Ubuntu Package | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: yarn electron-builder --publish never --linux snap | |
# Install AWS CLI | |
- name: Install AWS CLI | |
uses: aws-actions/setup-aws-cli@v2 | |
# Upload artifacts to Wasabi (Windows) | |
- name: Upload Artifacts to Wasabi (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
aws s3 cp dist/ s3://${{ secrets.WASABI_BUCKET_NAME }}/windows-latest/ --recursive --exclude "*" --include "rocketchat-*.exe" --acl public-read --endpoint-url=https://s3.us-east-1.wasabisys.com | |
shell: pwsh | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.WASABI_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.WASABI_SECRET_ACCESS_KEY }} | |
# Upload artifacts to Wasabi (macOS) | |
- name: Upload Artifacts to Wasabi (macOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
aws s3 cp dist/ s3://${{ secrets.WASABI_BUCKET_NAME }}/macos-latest/ --recursive --exclude "*" --include "rocketchat-*.dmg" --include "rocketchat-*.pkg" --acl public-read --endpoint-url=https://s3.us-east-1.wasabisys.com | |
shell: bash | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.WASABI_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.WASABI_SECRET_ACCESS_KEY }} | |
# Upload artifacts to Wasabi (Ubuntu) | |
- name: Upload Artifacts to Wasabi (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
aws s3 cp dist/ s3://${{ secrets.WASABI_BUCKET_NAME }}/ubuntu-latest/ --recursive --exclude "*" --include "rocketchat-*.snap" --acl public-read --endpoint-url=https://s3.us-east-1.wasabisys.com | |
shell: bash | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.WASABI_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.WASABI_SECRET_ACCESS_KEY }} | |
# Get Artifact URLs | |
- name: Get Artifact URLs | |
id: get-artifact-urls | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const os = '${{ matrix.os }}'; | |
const bucketName = '${{ secrets.WASABI_BUCKET_NAME }}'; | |
const endpoint = 'https://s3.wasabisys.com'; | |
const artifactDir = 'dist'; | |
const fs = require('fs'); | |
const path = require('path'); | |
let patterns = []; | |
if (os === 'windows-latest') { | |
patterns = ['rocketchat-*.exe']; | |
} else if (os === 'macos-latest') { | |
patterns = ['rocketchat-*.dmg', 'rocketchat-*.pkg']; | |
} else if (os === 'ubuntu-latest') { | |
patterns = ['rocketchat-*.snap']; | |
} else { | |
core.setFailed(`Unsupported OS: ${os}`); | |
} | |
const glob = require('glob'); | |
let artifactUrls = ''; | |
for (const pattern of patterns) { | |
const files = glob.sync(path.join(artifactDir, pattern)); | |
for (const file of files) { | |
const fileName = path.basename(file); | |
const artifactUrl = `${endpoint}/${bucketName}/${os}/${fileName}`; | |
artifactUrls += `- [${fileName}](${artifactUrl})\n`; | |
} | |
} | |
core.setOutput('artifact_urls', artifactUrls.trim()); | |
# Install glob dependency | |
prelude: | | |
const glob = require('glob'); | |
- name: Post PR Comment with the Artifact links | |
if: steps.get-artifact-urls.outputs.artifact_urls != '' | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: | | |
### Artifact for ${{ matrix.os }} | |
${{ steps.get-artifact-urls.outputs.artifact_urls }} | |
header: '### Artifact for ${{ matrix.os }}' | |
recreate: true | |
append: false |