Skip to content

Commit

Permalink
Create GitHub Actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
PolpOnline committed Nov 20, 2024
1 parent 635df93 commit f7a4b7a
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build & Publish Backend

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create image name
id: image_name
run: echo "IMAGE_NAME=ghcr.io/$(echo "${{ github.repository }}-backend" | tr '[:upper:]' '[:lower:]')" > "$GITHUB_ENV"

# create a unique tag for each build for debugging
- name: Set Docker tag
id: date
run: echo "DATE_STAMP=$(date +%s)" > "$GITHUB_ENV"

- name: Build and push Docker images
uses: iloveitaly/github-action-nixpacks@main
with:
context: './src/backend'
push: true
tags: |
${{ env.IMAGE_NAME }}:sha-${{ env.DATE_STAMP }}
${{ env.IMAGE_NAME }}:latest
38 changes: 38 additions & 0 deletions .github/workflows/ci-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build & Publish Frontend

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create image name
id: image_name
run: echo "IMAGE_NAME=ghcr.io/$(echo "${{ github.repository }}-frontend" | tr '[:upper:]' '[:lower:]')" > "$GITHUB_ENV"

# create a unique tag for each build for debugging
- name: Set Docker tag
id: date
run: echo "DATE_STAMP=$(date +%s)" > "$GITHUB_ENV"

- name: Build and push Docker images
uses: iloveitaly/github-action-nixpacks@main
with:
context: './src/frontend'
push: true
tags: |
${{ env.IMAGE_NAME }}:sha-${{ env.DATE_STAMP }}
${{ env.IMAGE_NAME }}:latest
2 changes: 0 additions & 2 deletions src/backend/.cargo/config.toml

This file was deleted.

0 comments on commit f7a4b7a

Please sign in to comment.