updated #26
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: Build/release Desktop app | |
on: | |
push: | |
branches: | |
- main | |
repository_dispatch: | |
types: [trigger-action] | |
jobs: | |
create-tag: | |
runs-on: ubuntu-latest | |
outputs: | |
new_tag: ${{ steps.tag_version.outputs.new_tag }} | |
changelog: ${{ steps.tag_version.outputs.changelog }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
node-version: 20 | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.2 | |
with: | |
github_token: ${{ secrets.ACCESS_TOKEN }} | |
default_bump: minor | |
tag_prefix: "" | |
release: | |
needs: create-tag | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
env: | |
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ secrets.APP_REPO }} | |
token: ${{ env.GH_TOKEN }} | |
path: 'app' | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install Dependencies | |
run: |- | |
cd app | |
npm install | |
- name: Link API Client Package | |
run: |- | |
cd app/packages/api-client | |
npm link | |
- name: Install Electron Dependencies | |
run: |- | |
cd app/desktop-app | |
npm install | |
npm link @packages/api-client | |
- name: build-linux | |
if: matrix.os == 'ubuntu-latest' | |
run: |- | |
cd app/desktop-app | |
npm run build:linux | |
- name: build-mac | |
if: matrix.os == 'macos-latest' | |
run: |- | |
cd app/desktop-app | |
npm run build:mac | |
- name: build-win | |
if: matrix.os == 'windows-latest' | |
run: |- | |
cd app/desktop-app | |
npm run build:win | |
# latest -> lae -> dist | |
- name: Remove spaces in file names - (mac & linux) | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd app/desktop-app | |
mkdir -p formatted-dist | |
for file in dist/*; do | |
mv "$file" "formatted-dist/$(echo $file | tr ' ' '-' | sed 's|dist/||')" | |
done | |
- name: Remove spaces in file names - (windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd app\desktop-app | |
mkdir formatted-dist -ErrorAction Ignore | |
Get-ChildItem dist\* -File | ForEach-Object { | |
$newName = $_.Name -replace ' ', '-' | |
Move-Item $_.FullName -Destination ("formatted-dist\" + $newName) | |
} | |
shell: pwsh | |
- name: release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.create-tag.outputs.new_tag }} | |
name: Release ${{ needs.create-tag.outputs.new_tag }} | |
body: 'Changes in this Release: ${{ needs.create-tag.outputs.changelog }}' | |
token: ${{ env.GH_TOKEN }} | |
draft: false | |
prerelease: false | |
files: | | |
app/desktop-app/formatted-dist/*.exe | |
app/desktop-app/formatted-dist/*.zip | |
app/desktop-app/formatted-dist/*.dmg | |
app/desktop-app/formatted-dist/*.AppImage | |
app/desktop-app/formatted-dist/*.snap | |
app/desktop-app/formatted-dist/*.exe | |
app/desktop-app/formatted-dist/*.deb | |
app/desktop-app/formatted-dist/*.rpm | |
app/desktop-app/formatted-dist/*.tar.gz | |
app/desktop-app/formatted-dist/*.yml | |
app/desktop-app/formatted-dist/*.blockmap |