-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add github action runner & Dockerfile build (#6)
- Loading branch information
1 parent
d7164f0
commit 477fbef
Showing
3 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
node_modules | ||
Dockerfile* | ||
docker-compose* | ||
.dockerignore | ||
.git | ||
.gitignore | ||
README.md | ||
LICENSE | ||
.vscode | ||
Makefile | ||
helm-charts | ||
.env | ||
.editorconfig | ||
.idea | ||
coverage* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
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 | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
ARG WORKDIR=/build | ||
|
||
FROM ivangabriele/tauri:fedora-37-18 AS build | ||
|
||
ARG WORKDIR | ||
WORKDIR ${WORKDIR} | ||
|
||
RUN curl -fsSL https://bun.sh/install | bash | ||
ENV PATH="${PATH}:/root/.bun/bin/" | ||
|
||
COPY package.json bun.lockb "${WORKDIR}" | ||
RUN bun install --frozen-lockfile | ||
|
||
COPY . "${WORKDIR}" | ||
RUN bun run build | ||
|
||
FROM scratch AS artifacts | ||
|
||
ARG WORKDIR | ||
COPY --from=build \ | ||
"${WORKDIR}/src-tauri/target/release/bundle/appimage/citadel_0.1.0_amd64.AppImage" \ | ||
. | ||
COPY --from=build \ | ||
"${WORKDIR}/src-tauri/target/release/bundle/deb/citadel_0.1.0_amd64.deb" \ | ||
. |