Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chetan11-dev committed Nov 24, 2024
1 parent 04b4200 commit 8d805de
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .erb/scripts/upload-to-s3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from botasaurus import bt
from botasaurus.env import get_os
from botasaurus.task import task
import os

bucket_name = "awesome-app-distribution"

@task(output=None, raise_exception=True, close_on_crash=True, parallel=4)
def upload(data):
upload_file_name = bt.trim_and_collapse_spaces(os.path.basename(data)).replace(' ','')

uploaded_file_url = bt.upload_to_s3(
data,
bucket_name,
os.environ['AWS_ACCESS_KEY_ID'],
os.environ['AWS_SECRET_ACCESS_KEY'],
upload_file_name,
)

print(f"Visit {uploaded_file_url} to download the uploaded file.") # URL to share with users

app_name = bt.read_json('./package.json')['build']['productName']
operating_system = get_os()

if operating_system == "mac":
upload(f"./release/build/{app_name}.dmg")
elif operating_system == "windows":
upload(f"./release/build/{app_name}.exe")
elif operating_system == "linux":
upload(
[
f"./release/build/{app_name}-amd64.deb",
f"./release/build/{app_name}-arm64.deb",
f"./release/build/{app_name}-x86_64.rpm",
f"./release/build/{app_name}-aarch64.rpm",
]
)
112 changes: 112 additions & 0 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Package

on: [push, pull_request]

jobs:
package-mac:
# Notarization is taking too long, exit
timeout-minutes: 30
runs-on: macos-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Node.js and NPM
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm

- name: Recreate certificate.p12 from Base64
run: echo "${{ secrets.CSC_BASE64_ENCODED }}" | base64 -d > certificate.p12

- name: npm install
run: |
npm install
- name: Package
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
CSC_LINK: ./certificate.p12
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
run: |
npm run package
- name: Install packages needed for S3 upload
run: |
python -m pip install botasaurus boto3
- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
python .erb/scripts/upload-to-s3.py
package-windows:
timeout-minutes: 30
runs-on: windows-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Node.js and NPM
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm

- name: npm install
run: |
npm install
- name: Package
run: |
npm run package
- name: Install botasaurus package
run: |
python -m pip install botasaurus boto3
- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
python .erb/scripts/upload-to-s3.py
package-linux:
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Node.js and NPM
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm

- name: npm install
run: |
npm install
- name: Package
run: |
npm run package
- name: Install packages needed for S3 upload
run: |
python -m pip install botasaurus boto3
- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
python .erb/scripts/upload-to-s3.py

0 comments on commit 8d805de

Please sign in to comment.