-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04b4200
commit 8d805de
Showing
2 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
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
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", | ||
] | ||
) |
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
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 |