armcord/.github/workflows/stable.yml

234 lines
8.1 KiB
YAML
Raw Permalink Normal View History

name: Release build
on:
push:
branches:
2022-11-22 16:24:15 +00:00
- stable
env:
FORCE_COLOR: true
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
2022-11-22 16:14:50 +00:00
- uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
- name: Use Node.js 18
uses: actions/setup-node@v2
with:
node-version: 18
cache: "pnpm"
2022-10-08 15:43:08 +00:00
- name: Install Node dependencies
2022-10-08 16:11:34 +00:00
run: pnpm install -g cargo-cp-artifact && pnpm install
- name: Install Electron-Builder
2022-10-08 15:43:08 +00:00
run: pnpm install -g electron-builder
- name: Build
run: npm run build && electron-builder --linux && electron-builder --arm64 --linux && electron-builder --armv7l --linux
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: List all files in the dist directory
run: ls -l dist
- name: Delete unpacked builds
run: rm -rf dist/linux-unpacked && rm -rf dist/linux-arm64-unpacked && rm -rf dist/linux-armv7l-unpacked
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ArmCordLinux
path: dist/
build-mac:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
2022-11-22 16:14:50 +00:00
- uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
- name: Use Node.js 18
uses: actions/setup-node@v2
with:
node-version: 18
cache: "pnpm"
2022-10-08 15:43:08 +00:00
- name: Install Node dependencies
2022-10-08 16:11:34 +00:00
run: pnpm install -g cargo-cp-artifact && pnpm install
2022-10-08 15:43:08 +00:00
- name: Install Electron-Builder
2022-10-08 15:43:08 +00:00
run: pnpm install -g electron-builder
- name: Build
2023-08-26 17:27:25 +00:00
run: npm run build && electron-builder --macos --x64 --arm64
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: List all files in the dist directory
run: ls -l dist
- name: Delete unpacked builds
run: rm -rf dist/macos-unpacked
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ArmCordMac
path: dist/
build-windows:
runs-on: windows-latest
2022-11-22 16:14:50 +00:00
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
- name: Use Node.js 18
uses: actions/setup-node@v2
with:
node-version: 18
cache: "pnpm"
- name: Install Node dependencies
run: pnpm install -g cargo-cp-artifact && pnpm install
- name: Install Electron-Builder
run: pnpm install -g electron-builder
2022-11-22 16:14:50 +00:00
- name: Build
run: npm run build && electron-builder --windows
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete unpacked builds
run: Remove-Item -LiteralPath ".\dist\win-unpacked" -Force -Recurse
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ArmCordWindows
path: dist/
build-windowsOnARM:
runs-on: windows-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Checkout code
uses: actions/checkout@v2
2022-11-22 16:14:50 +00:00
- name: Set architecture
run: set npm_config_arch=arm64
- uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
2022-10-08 15:43:08 +00:00
- name: Install Node dependencies
2022-10-08 16:11:34 +00:00
run: pnpm install -g cargo-cp-artifact && pnpm install
2022-10-08 15:43:08 +00:00
- name: Install Electron-Builder
2022-10-08 15:43:08 +00:00
run: pnpm install -g electron-builder
- name: Build
2022-11-22 16:14:50 +00:00
run: npm run build && electron-builder --windows --arm64
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete unpacked builds
2022-11-22 16:14:50 +00:00
run: Remove-Item -LiteralPath ".\dist\win-arm64-unpacked" -Force -Recurse
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
2022-11-22 16:14:50 +00:00
name: ArmCordWindowsArm64
path: dist/
release:
runs-on: ubuntu-latest
2022-11-22 16:14:50 +00:00
needs: [build-linux, build-mac, build-windows, build-windowsOnARM]
steps:
- uses: actions/download-artifact@v2
with:
name: ArmCordMac
path: macos
- uses: actions/download-artifact@v2
with:
name: ArmCordWindows
path: windows
2022-11-22 16:14:50 +00:00
- uses: actions/download-artifact@v2
with:
name: ArmCordWindowsArm64
path: windows
- uses: actions/download-artifact@v2
with:
name: ArmCordLinux
path: linux
- name: ls
run: ls
- name: Delete unwanted directories
run: rm -rf {linux,macos,windows}/*/
rm -rf {linux,macos,windows}/.icon*
rm -rf {linux,macos,windows}/builder-debug.yml
- name: ls dirs
run: ls linux && ls macos && ls windows
- name: Get some values needed for the release
id: vars
shell: bash
run: |
echo "::set-output name=releaseTag::$(git describe --tags --abbrev=0)"
- name: Create Release
uses: actions/github-script@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
console.log('environment', process.versions);
const fs = require('fs').promises;
const { repo: { owner, repo }, sha } = context;
console.log({ owner, repo, sha });
const release = await github.repos.createRelease({
owner, repo,
tag_name: process.env.releaseTag,
draft: true,
target_commitish: sha
});
console.log('created release', { release });
for (let file of await fs.readdir('linux')) {
// do whatever filtering you want here, I'm just uploading all the files
console.log('uploading', file);
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: release.data.id,
name: file,
data: await fs.readFile(`./linux/${file}`)
});
}
for (let file of await fs.readdir('windows')) {
// do whatever filtering you want here, I'm just uploading all the files
console.log('uploading', file);
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: release.data.id,
name: file,
data: await fs.readFile(`./windows/${file}`)
});
}
for (let file of await fs.readdir('macos')) {
// do whatever filtering you want here, I'm just uploading all the files
console.log('uploading', file);
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: release.data.id,
name: file,
data: await fs.readFile(`./macos/${file}`)
});
}
env:
2022-11-22 16:14:50 +00:00
releaseTag: ${{ steps.vars.outputs.releaseTag }}