Update release workflow to use new R2 upload action for multiple oper… #81
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: 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 workflow run magicwallet/r2-upload@main \ | |
--with endpoint=${{ secrets.R2_ENDPOINT }} \ | |
--with access_key_id=${{ secrets.R2_ACCESS_KEY_ID }} \ | |
--with secret_access_key=${{ secrets.R2_SECRET_ACCESS_KEY }} \ | |
--with bucket=${{ secrets.R2_BUCKET }} \ | |
--with file=$file \ | |
--with destination=releases/v${{ env.VERSION }}/$filename | |
done |