WIP #114
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-and-publish-mac-linux: | |
if: false | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
arch: [x64, arm64] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- 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 == 'macos-latest' && 'darwin' || 'linux' }} | |
- name: Extract version from package.json on Linux/macOS | |
run: | | |
VERSION=$(node -e "console.log(require('./package.json').version);") | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Upload files to Cloudflare R2 | |
run: | | |
for file in $(find out/make/ -type f); do | |
echo "Uploading $(basename "$file")" | |
aws s3 cp "$file" "s3://${{ secrets.R2_BUCKET }}/releases/v${{ env.VERSION }}/$(basename "$file")" \ | |
--endpoint-url="${{ secrets.R2_ENDPOINT }}" --debug | |
done | |
shell: bash | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.R2_REGION }} | |
build-and-publish-windows: | |
strategy: | |
matrix: | |
arch: [x64, arm64] | |
runs-on: windows-latest | |
steps: | |
- name: Set PowerShell Execution Policy | |
run: | | |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | |
shell: pwsh | |
- name: Set up environment variables | |
run: | | |
echo "WINDOWS_KIT_PATH=C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x64" >> $env:GITHUB_ENV | |
shell: pwsh | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Package Electron App | |
run: | | |
npx electron-packager . Comet --platform=win32 --arch=${{ matrix.arch }} --out=out --overwrite | |
- name: Convert Electron App to AppX | |
run: | | |
electron-windows-store --input-directory out\Comet-win32-${{ matrix.arch }} --output-directory out\appx --package-version 1.0.0.0 --package-name Comet --package-display-name "Comet Video Converter" --package-description "A simple video converter" --package-executable Comet.exe --publisher "CN=${{ secrets.PUBLISHER }}" --dev-cert $(pwd)\\tools\\certs\\dev-cert.pfx --cert-pass ${{ secrets.CERT_PASSWORD }} --windows-kit ${{ env.WINDOWS_KIT_PATH }} | |
shell: pwsh | |
- name: Upload files to Cloudflare R2 | |
run: | | |
Get-ChildItem -Path out\appx -File | ForEach-Object { | |
Write-Host "Uploading $($_.Name)" | |
aws s3 cp $_.FullName "s3://${{ secrets.R2_BUCKET }}/releases/v1.0.0.0/$($_.Name)" ` | |
--endpoint-url="${{ secrets.R2_ENDPOINT }}" --debug | |
} | |
shell: pwsh | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.R2_REGION }} | |
create-release: | |
if: false | |
needs: [build-and-publish-mac-linux, build-and-publish-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract version from package.json | |
run: | | |
VERSION=$(node -e "console.log(require('./package.json').version);") | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
tag_name: v${{ env.VERSION }} | |
release_name: v${{ env.VERSION }} | |
body: | | |
Changes in this Release | |
draft: true | |
prerelease: false |