From 5907d43607d7b9024a45552c82faeec79f9bf35c Mon Sep 17 00:00:00 2001
From: Grzegorz Placzek <gplaczek@antmicro.com>
Date: Mon, 12 Feb 2024 11:51:41 +0100
Subject: [PATCH] [#54869] Add build, test and release workflows

---
 .github/workflows/build.yml  | 29 +++++++++++++++++++++++++++++
 .github/workflows/deploy.yml | 26 ++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 .github/workflows/build.yml
 create mode 100644 .github/workflows/deploy.yml

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..21bea96
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,29 @@
+name: build jswasi
+
+on:
+  push:
+    branches:
+      - '**'
+      - '!main'
+  pull_request:
+  workflow_call:
+
+jobs:
+  build-and-test:
+    runs-on: ubuntu-latest
+    container:
+      image: debian:bookworm
+    steps:
+      - name: Install dependencies
+        run: apt-get -qqy update && apt-get -qqy install node-typescript make gettext-base npm wget
+      - name: Checkout sources
+        uses: actions/checkout@v4
+      - name: Build jswasi
+        run: make standalone
+      - name: Test jswasi
+        run: make test
+      - name: Upload dist
+        uses: actions/upload-artifact@v3
+        with:
+          name: jswasi
+          path: ./dist/
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..30d4e9e
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,26 @@
+name: deploy demo
+
+on:
+  push:
+    branches:
+      - 'main'
+
+jobs:
+  build:
+    name: Build jswasi
+    uses: ./.github/workflows/build.yml
+  deploy:
+    runs-on: ubuntu-latest
+    needs: [build]
+    steps:
+      - name: Checkout sources
+        uses: actions/checkout@v4
+      - name: Download jswasi artifact
+        uses: actions/download-artifact@v3
+        with:
+          name: jswasi
+          path: ./dist
+      - name: Deploy
+        uses: JamesIves/github-pages-deploy-action@v4
+        with:
+          folder: ./dist