Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add extra file upload method for specific OS in release mode #66

Merged
merged 4 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ jobs:

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x.x

- name: Set node version to 18
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: pnpm

- run: pnpm install
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: 'Publish mCal'
# this workflow is triggered on push to any push to any branch so that we can test the app on every canary release
name: 'Canary Release'

on:
push:
Expand All @@ -9,86 +10,91 @@ concurrency:

jobs:
build-binaries:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [ macos-latest, ubuntu-latest, windows-latest ]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: szenius/set-timezone@v1.2
with:
timezoneLinux: "Asia/Yangon"
timezoneMac: "Asia/Yangon"
timezoneWindows: "Myanmar Standard Time"

- name: Setup pnpm
uses: pnpm/action-setup@v2.0.1
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.2
version: 8.x.x

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm run build

- name: install Rust stable
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: install dependencies (ubuntu only)
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf

- uses: JonasKruckenberg/tauri-build@v1
id: tauri_build

- name: Unix like list files in dist directory
if: ${{matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest' }}
run: ls
- name: Build mCal frontend
run: pnpm build

- name: Windows like list files in dist directory
if: ${{matrix.platform == 'windows-latest'}}
run: dir
# build tauri app
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: Upload artifact to macOS
- name: Upload DMG artifact to macOS
if: ${{ matrix.platform == 'macos-latest' }}
uses: actions/upload-artifact@v3
with:
name: MacOS (DMG)
path: |
./apps/myanmar_calendar/src-tauri/target/release/bundle/dmg/*.dmg

- name: Upload artifact to linux
- name: Upload Deb artifact to linux
if: ${{ matrix.platform == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: Linux Deb
path: |
./apps/myanmar_calendar/src-tauri/target/release/bundle/deb/*.deb

- name: Upload AppImage artifact to linux
if: ${{ matrix.platform == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: Linux (DEB & AppImage)
name: Linux AppImage
path: |
./apps/myanmar_calendar/src-tauri/target/release/bundle/deb/*.deb
./apps/myanmar_calendar/src-tauri/target/release/bundle/appimage/*.AppImage

- name: Upload artifact to Window
- name: Upload MSI artifact to Window
if: ${{ matrix.platform == 'windows-latest' }}
uses: actions/upload-artifact@v3
with:
name: Windows (MSI & NSIS)
name: Windows MSI
path: |
./apps/myanmar_calendar/src-tauri/target/release/bundle/msi/*.msi
./apps/myanmar_calendar/src-tauri/target/release/bundle/nsis/*.exe


- name: Upload NSIS artifact to Window
if: ${{ matrix.platform == 'windows-latest' }}
uses: actions/upload-artifact@v3
with:
name: Windows NSIS
path: |
./apps/myanmar_calendar/src-tauri/target/release/bundle/nsis/*.exe
108 changes: 94 additions & 14 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,107 @@
name: 'Create Release on specific version tag'

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

permissions: {}
jobs:
build:
create-release:
permissions:
contents: write # to create release (yyx990803/release-tag)
contents: write
runs-on: ubuntu-20.04
outputs:
release_id: ${{ steps.create-release.outputs.result }}

name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create Release for Tag
id: release_tag
uses: yyx990803/release-tag@master
- uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: get version
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: create release
id: create-release
uses: actions/github-script@v6
with:
script: |
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `app-v${process.env.PACKAGE_VERSION}`,
name: `Desktop App v${process.env.PACKAGE_VERSION}`,
body: 'Take a look at the assets to download and install this app.',
draft: true,
prerelease: false
})
return data.id

build-tauri:
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [ macos-latest, ubuntu-latest, windows-latest ]

runs-on: ${{ matrix.platform }}
steps:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x.x

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf

- name: Build mCal frontend
run: pnpm build

# build tauri app
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body: |
Please refer to [CHANGELOG.md](https://raw.githubusercontent.com/myanmarcyberyouths/mCal/main/CHANGELOG.md) for details.
releaseId: ${{ needs.create-release.outputs.release_id }}

publish-release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: [ create-release, build-tauri ]

steps:
- name: publish release
id: publish-release
uses: actions/github-script@v6
env:
release_id: ${{ needs.create-release.outputs.release_id }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.release_id,
draft: false,
prerelease: false
})
59 changes: 59 additions & 0 deletions .github/workflows/test-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This workflow will build a Tauri app on every pull request so we can test it before merging it to main branch
name: 'Test on PR'

on: [ pull_request ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [ macos-latest, ubuntu-latest, windows-latest ]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x.x

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf

- name: Build mCal frontend
run: pnpm build

# build tauri app
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}



1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=true
5 changes: 2 additions & 3 deletions apps/myanmar_calendar/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"name": "myanmar_calendar",
"name": "mcal",
"private": true,
"version": "3.2.0",
"scripts": {
"tauri": "tauri",
"dev": "vite dev",
"build": "vite build",
"start": "vite start",
"lint": "next lint"
"start": "vite start"
},
"devDependencies": {
"@tauri-apps/cli": "^1.4.0",
Expand Down
Loading