build: add github action runner & Dockerfile build #6
Workflow file for this run
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
create_release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-20.04 | |
outputs: | |
release_id: ${{ steps.create-release.outputs.result }} | |
steps: | |
- 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: `v${process.env.PACKAGE_VERSION}-${new Date().toISOString().split('T')[0].replace(/-/g, '')}-${process.env.GITHUB_SHA.substring(0,7)}`, | |
name: `Auto build v${process.env.PACKAGE_VERSION}-${new Date().toISOString().split('T')[0].replace(/-/g, '')}-${process.env.GITHUB_SHA.substring(0,7)}`, | |
body: 'This is an auto-generated release for the latest commit on the main branch.', | |
draft: true, | |
prerelease: true | |
}) | |
return data.id | |
build_app: | |
needs: [create_release] | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-22.04, macos-12] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: (Ubuntu only) Install dependencies | |
if: matrix.platform == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf | |
- name: Install node packages | |
run: bun install | |
- name: List installed versions | |
run: | | |
bun --verison; | |
cargo --version; | |
bun tauri --version | |
- uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tauriScript: bun tauri | |
releaseId: ${{ needs.create_release.outputs.release_id }} | |
- name: Upload build artifacts (Ubuntu) | |
if: matrix.platform == 'ubuntu-22.04' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: tauri-build-ubuntu | |
path: | | |
src-tauri/target/release/bundle/deb/citadel_0.1.0_amd64.deb | |
src-tauri/target/release/bundle/appimage/citadel_0.1.0_amd64.AppImage | |
- name: Upload build artifacts (macOS) | |
if: matrix.platform == 'macos-12' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: tauri-build-macos | |
path: | | |
src-tauri/target/release/bundle/macos/Citadel.app.tar.gz | |
src-tauri/target/release/bundle/dmg/Citadel_0.1.0_x64.dmg | |
publish-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-20.04 | |
needs: [create_release, build_app] | |
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: true, | |
prerelease: true | |
}) |