Skip to content

Commit

Permalink
Merge pull request #89 from COS301-SE-2024/v0.1.0
Browse files Browse the repository at this point in the history
v0.1.0
  • Loading branch information
waveyboym authored Jun 24, 2024
2 parents e043757 + 4e69e0c commit 36f5318
Show file tree
Hide file tree
Showing 325 changed files with 18,122 additions and 21,420 deletions.
153 changes: 153 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Build and Release all

on:
push:
branches:
- action-needs-refinement-lol

jobs:
build-backend-binary:
name: Build Backend Binary
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.16'

- name: Build Backend Binary
run: |
go build -o occupi-backend ./occupi-backend/cmd/occupi-backend/main.go
- name: Archive Backend Binary
run: |
mkdir -p dist
mv occupi-backend/occupi-backend dist/occupi-backend
zip -r dist/occupi-backend.zip dist/occupi-backend
- name: Upload Backend Binary
uses: actions/upload-artifact@v2
with:
name: occupi-backend
path: dist/occupi-backend.zip


build-expo-app:
name: Build Expo App for Android and iOS
runs-on: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'

- name: Install Expo CLI
run: |
npm install -g expo-cli
- name: Install Expo dependencies
run: |
cd occupi-frontend
npm install
- name: Build Expo App for native platforms
run: |
cd occupi-frontend/occupi-mobile
expo build
- name: Archive Expo App for Android and iOS
run: |
mkdir -p dist
mv occupi-frontend/occupi-mobile/dist dist/occupi-mobile
zip -r dist/occupi-mobile.zip dist/occupi-mobile
- name: Upload Expo App for Android and iOS
uses: actions/upload-artifact@v2
with:
name: occupi-mobile
path: dist/occupi-backend.zip

build-vite-app:
name: Build Vite App
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install Vite
run: |
npm install -g create-vite
- name: Install Vite dependencies
run: |
cd occupi-frontend
npm install
- name: Build Vite App
run: |
cd occupi-frontend
npm run build
build-tauri-app:
name: Build Tauri App
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Rust
uses: actions/setup-rust@v1
with:
rust-version: '1.53.0'

- name: Install Tauri
run: |
cargo install tauri-bundler --force
- name: Build Tauri App
run: |
cd occupi-frontend
tauri build
release:
name: Release
runs-on: ubuntu-latest
needs: [build-backend-binary, build-expo-app, build-vite-app, build-tauri-app]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install GitHub CLI
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh
- name: Login to GitHub
run: |
gh auth login
- name: Create a Release
run: |
gh release create v1.0.0 -t "v1.0.0" -n "v1.0.0" ./occupi-backend/occupi-backend ./occupi-frontend/occupi-frontend ./occupi-frontend/dist ./occupi-frontend/build ./occupi-frontend/target/release/occupi-frontend
- name: Upload Release Assets
run: |
gh release upload v1.0.0 ./occupi-backend/occupi-backend ./occupi-frontend/occupi-frontend ./occupi-frontend/dist ./occupi-frontend/build ./occupi-frontend/target/release/occupi-frontend
93 changes: 60 additions & 33 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Docs site to Pages
name: Deploy Docs site to Live site

on:
push:
Expand All @@ -21,7 +21,7 @@ defaults:

jobs:
# Build job
build:
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -32,43 +32,70 @@ jobs:
with:
bun-version: latest # or "latest", "canary", <sha>

- name: Setup Pages
uses: actions/configure-pages@v4
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next

- name: Install dependencies with Bun
run: bun install

- name: Build with Next.js
run: bun run build
run: bun run build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: documentation/occupi-docs/out
build-push-docker:
name: Build and Push Documentation Docker Image
runs-on: ubuntu-latest
needs: build-test

# Deployment job
deploy:
name: Deploy to GitHub Pages
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: documentation/occupi-docs
file: documentation/occupi-docs/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/occupi-documentation:latest

deploy:
name: Deploy Documentation
runs-on: ubuntu-latest
needs: build-push-docker

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Copy files to VM
uses: appleboy/[email protected]
with:
host: ${{ secrets.VM_IP }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.VM_SSH_KEY }}
source: "documentation/occupi-docs/docker-compose.yml,documentation/occupi-docs/Dockerfile"
target: "/home/${{ secrets.VM_USERNAME }}/occupi-docs"

# SSH to VM and run commands
- name: SSH to VM
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VM_IP }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.VM_SSH_KEY }}
script: |
cd /home/${{ secrets.VM_USERNAME }}/occupi-docs/documentation/occupi-docs
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml down
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml pull
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml up -d
Loading

0 comments on commit 36f5318

Please sign in to comment.