Skip to content

update release workflow to use new R2 upload action for multiple oper… #80

update release workflow to use new R2 upload action for multiple oper…

update release workflow to use new R2 upload action for multiple oper… #80

Workflow file for this run

name: Release
on:
push:
branches:
- release
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x64, arm64]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Cache Node.js modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Install dependencies
run: npm install
- name: Build Electron app
run: |
npm run make -- --arch=${{ matrix.arch }}
env:
ELECTRON_CACHE: ${{ runner.temp }}/electron
npm_config_arch: ${{ matrix.arch }}
npm_config_platform: ${{ matrix.os }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ matrix.arch }}-distributables
path: out/make
publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Extract version from package.json
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: all-distributables
- name: Upload each file to Cloudflare R2
run: |
for file in $(find all-distributables/ -type f); do
filename=$(basename $file)
echo "Uploading $filename"
gh run-action ryand56/r2-upload-action@latest \
--with r2-account-id=${{ secrets.R2_ACCOUNT_ID }} \
--with r2-access-key-id=${{ secrets.R2_ACCESS_KEY_ID }} \
--with r2-secret-access-key=${{ secrets.R2_SECRET_ACCESS_KEY }} \
--with r2-bucket=${{ secrets.R2_BUCKET }} \
--with source-dir=$file \
--with destination-dir=releases/v${{ env.VERSION }}/$filename
done