# docs https://github.com/marketplace/actions/create-release # docs https://github.com/ncipollo/release-action # docs https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job#choosing-github-hosted-runners name: release on: push: tags: - 'v*' jobs: linux: runs-on: ubuntu-22.04 permissions: contents: write steps: # electron build - uses: actions/checkout@v2 with: # needed for git commit history changelog fetch-depth: 0 - name: Setup Node.js v20 uses: actions/setup-node@v2 with: node-version: 20 - name: Install dependencies (with Node v20) run: yarn install --frozen-lockfile --ignore-engines # make sure the ipfs executable is executable - name: Download IPFS and set permissions (with Node v20) run: node electron/download-ipfs && sudo chmod +x bin/linux/ipfs - name: Setup Node.js v22 for Electron build uses: actions/setup-node@v2 with: node-version: 22 - name: Build React app (with Node v22) run: CI='' yarn build - name: Build Electron app for Linux (with Node v22) run: yarn electron:build:linux - name: List dist directory run: ls dist # publish version release - name: Generate release body run: node scripts/release-body > release-body.txt - uses: ncipollo/release-action@v1 with: artifacts: 'dist/plebchan*.AppImage,dist/plebchan-html*.zip' token: ${{ secrets.GITHUB_TOKEN }} replacesArtifacts: true bodyFile: "release-body.txt" allowUpdates: true mac: runs-on: macOS-13 permissions: contents: write steps: # electron build - uses: actions/checkout@v2 with: # needed for git commit history changelog fetch-depth: 0 - name: Setup Node.js v20 uses: actions/setup-node@v2 with: node-version: 20 # install missing dep for sqlite - run: python3 -m ensurepip - run: pip install setuptools - name: Install dependencies (with Node v20) run: yarn install --frozen-lockfile --ignore-engines # make sure the ipfs executable is executable - name: Download IPFS and set permissions (with Node v20) run: node electron/download-ipfs && sudo chmod +x bin/mac/ipfs - name: Setup Node.js v22 for Electron build uses: actions/setup-node@v2 with: node-version: 22 - name: Build React app (with Node v22) run: CI='' yarn build - name: Build Electron app for Mac (with Node v22) run: yarn electron:build:mac - name: List dist directory run: ls dist # publish version release - name: Generate release body run: node scripts/release-body > release-body.txt - uses: ncipollo/release-action@v1 with: artifacts: 'dist/plebchan*.dmg' token: ${{ secrets.GITHUB_TOKEN }} replacesArtifacts: true bodyFile: "release-body.txt" allowUpdates: true windows: runs-on: windows-2022 permissions: contents: write steps: # electron build - uses: actions/checkout@v2 with: # needed for git commit history changelog fetch-depth: 0 - name: Setup Node.js v22 # electron-rebuild needs Node 22+ uses: actions/setup-node@v2 with: node-version: 22 - name: Install dependencies (with Node v22) # --network-timeout and --network-concurrency are yarn v1 flags. run: yarn install --frozen-lockfile --network-timeout 100000 --network-concurrency 1 - name: Build React app (with Node v22) run: yarn build - name: Build Electron app for Windows (with Node v22) run: yarn electron:build:windows - name: List dist directory run: dir dist # publish version release - name: Generate release body run: node scripts/release-body > release-body.txt - uses: ncipollo/release-action@v1 with: artifacts: 'dist/plebchan*.exe' token: ${{ secrets.GITHUB_TOKEN }} replacesArtifacts: true bodyFile: "release-body.txt" allowUpdates: true android: runs-on: ubuntu-22.04 permissions: contents: write steps: - uses: actions/checkout@v2 with: # needed to use 'git tag' and get all tags and for git commit history changelog fetch-depth: 0 - uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '21' - uses: gradle/gradle-build-action@v2 with: gradle-version: 8.9 - uses: actions/setup-node@v2 with: node-version: 20 - run: sudo apt install -y apksigner zipalign # install all dependencies (including devDependencies needed for React build) - name: Install dependencies (with Node v20) run: yarn install --frozen-lockfile --ignore-engines # build react app - run: CI='' yarn build # set android versionCode and versionName - run: sed -i "s/versionCode 1/versionCode $(git tag | wc -l)/" ./android/app/build.gradle - run: sed -i "s/versionName \"1.0\"/versionName \"$(node -e "console.log(require('./package.json').version)")\"/" ./android/app/build.gradle - run: cat ./android/app/build.gradle # build apk - run: npx cap update - run: npx cap copy - run: cd android && gradle bundle - run: cd android && ./gradlew assembleRelease # optimize apk - run: cd android/app/build/outputs/apk/release && zipalign 4 app-release-unsigned.apk app-release-unsigned-zip.apk # sign apk # to create keystore: keytool -genkey -v -keystore plebbit.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias release - run: cd android/app/build/outputs/apk/release && apksigner sign --ks ../../../../../plebbit.keystore --ks-pass pass:${{ secrets.PLEBBIT_REACT_KEYSTORE_PASSWORD }} --ks-key-alias release --out app-release-signed.apk app-release-unsigned-zip.apk # move apk to dist folder - run: mkdir -p dist && mv android/app/build/outputs/apk/release/app-release-signed.apk dist/plebchan-$(node -e "console.log(require('./package.json').version)").apk - run: ls dist # publish version release - run: node scripts/release-body > release-body.txt - uses: ncipollo/release-action@v1 with: artifacts: 'dist/plebchan*.apk' token: ${{ secrets.GITHUB_TOKEN }} replacesArtifacts: true bodyFile: "release-body.txt" allowUpdates: true