Skip to content

Commit

Permalink
[#198]: Blog release workflow (#392)
Browse files Browse the repository at this point in the history
* [#198]: Blog release workflow

* [#198]: Blog release workflow

* [#198]: Blog release workflow

* [#198]: Update readme

* [#198]: Update readme
  • Loading branch information
Themezv authored Aug 14, 2023
1 parent cfd90db commit 39e2338
Show file tree
Hide file tree
Showing 10 changed files with 259 additions and 104 deletions.
25 changes: 25 additions & 0 deletions .deploy/blog.deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3.3"
services:
blog:
image: ghcr.io/memebattle/blog:latest
networks:
- traefik-public
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.blog.rule=Host(`blog.mems.fun`)"
- "traefik.http.routers.blog.entrypoints=web"
- "traefik.http.services.blog.loadbalancer.server.port=3000"
- "traefik.http.services.blog.loadbalancer.passhostheader=true"
replicas: 1
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 3

networks:
traefik-public:
external: true
31 changes: 31 additions & 0 deletions .docker/Blog_Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM node:18.14-bullseye-slim AS dependencies

WORKDIR /memebattle

COPY .yarn/ /memebattle/.yarn
COPY package.json yarn.lock .yarnrc.yml /memebattle/
COPY apps/blog/package.json /memebattle/apps/blog/

RUN yarn install

FROM dependencies AS build

ENV NODE_ENV=production

COPY . /memebattle
WORKDIR /memebattle/apps/blog

RUN node ../../node_modules/.bin/next build

FROM node:18.14-bullseye-slim AS runtime
ENV NODE_ENV=production

RUN mkdir -p /memebattle
WORKDIR /memebattle
USER node

COPY --chown=node:node --from=build /memebattle/apps/blog/public ./apps/blog/public
COPY --chown=node:node --from=build /memebattle/apps/blog/.next/standalone ./
COPY --chown=node:node --from=build /memebattle/apps/blog/.next/static ./apps/blog/.next/static

ENTRYPOINT [ "node", "apps/blog/server.js" ]
15 changes: 15 additions & 0 deletions .docker/Blog_Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*
!apps/blog

!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

!yarn.lock
!.yarnrc.yml
!package.json
!tsconfig.json
!typings
!.env*
76 changes: 76 additions & 0 deletions .github/workflows/blog-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: 'Blog build, push and deploy'

on:
push:
branches: [ master ]
paths:
- 'apps/blog/**'
- '.deploy/blog.deploy.yml'
- '.docker/Blog_Dockerfile*'
- '.github/workflows/blog-deploy.yml'

env:
AWS_REGION: 'eu-north-1'

jobs:

build-blog-image:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760

- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
platforms: linux/arm64
push: true
tags: |
ghcr.io/memebattle/blog:${{ github.sha }}
ghcr.io/memebattle/blog:latest
context: '.'
file: '.docker/Blog_Dockerfile'
cache-from: type=gha,scope=$GITHUB_REF_NAME-blog
cache-to: type=gha,mode=max,scope=$GITHUB_REF_NAME-blog

deploy:
needs: [build-blog-image]

runs-on: ubuntu-20.04

environment:
name: Blog-production
url: https://blog.mems.fun

steps:
- uses: actions/checkout@v3
name: Checkout

- uses: ./.github/actions/deploy-to-swarm
name: Deploy to swarm lambda
with:
path-to-stack: '.deploy/blog.deploy.yml'
name: 'BLOG'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
docker_login: ${{ secrets.GHCR_USER }}
docker_password: ${{ secrets.GHCR_PULL_TOKEN }}
docker_registry: 'ghcr.io'
3 changes: 3 additions & 0 deletions .github/workflows/ligretto-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ on:
branches: [ master ]
paths-ignore:
- 'apps/gamehub-client/**'
- 'apps/blog/**'
- '.deploy'
- '!.deploy/ligretto.deploy.yml'
- '.docker'
- '!.docker/Ligretto*'

env:
AWS_REGION: 'eu-north-1'
Expand Down
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/87e9a6dd862ad81868c3/maintainability)](https://codeclimate.com/github/MemeBattle/monorepo/maintainability)

<div align="center">
<h1 align="center">Welcome to MemeBattle!</h1>
<img align="center" src="./docs/assets/memebattle-logo.svg" height="96" />
</div>

## What is MemeBattle?
**MemeBattle** - open community
**MemeBattle** is an <b>open community</b> united by common projects.
We are open to new ideas and projects and are happy to invite everyone to join us.

## Applications
> [!NOTE]
> [Read more in blog](https://blog.mems.fun/en/posts/what-is-memebattle)
[![Maintainability](https://api.codeclimate.com/v1/badges/87e9a6dd862ad81868c3/maintainability)](https://codeclimate.com/github/MemeBattle/monorepo/maintainability)
## Projects

### Ligretto

**Ligretto** is fast-paced online multiplayer game in which you need to lay out cards as quickly as possible and outperform your opponents with reaction and agility.

URL: https://ligretto.app

UI-kit: https://ui.ligretto.app/
Expand All @@ -21,8 +28,17 @@ GitHub project: https://github.com/orgs/MemeBattle/projects/1

### GameHub

**GameHub** is online games service. Unfortunately, there is only one game so far. But in the ideal future, it will be a portal for multiple online games in one ecosystem.

URL: https://mems.fun

### Blog

Not only news from the MemeBattle team, but also various posts from everyone.
First of all, we would like to share technical discoveries and experiences.

URL: https://blog.mems.fun/

## First steps
1. Read [documentation](./docs)
2. Read [CONTRIBUTING.md](CONTRIBUTING.md) TODO: Create contribution doc [#215](https://github.com/MemeBattle/monorepo/issues/215)
Expand Down
8 changes: 6 additions & 2 deletions apps/blog/next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withContentlayer } = require('next-contentlayer')
/* eslint-disable @typescript-eslint/no-var-requires */
const { createContentlayerPlugin } = require('next-contentlayer')
const { resolve } = require('node:path')

const withContentlayer = createContentlayerPlugin({ configPath: resolve(__dirname, './contentlayer.config.js') })

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
output: 'standalone',
experimental: {
appDir: true,
typedRoutes: true,
Expand Down
3 changes: 2 additions & 1 deletion apps/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^12.2.0",
"server-only": "^0.0.1"
"server-only": "^0.0.1",
"sharp": "^0.32.4"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.9",
Expand Down
2 changes: 1 addition & 1 deletion apps/gamehub-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"next": "^13.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sharp": "^0.32.0"
"sharp": "^0.32.4"
},
"devDependencies": {
"@types/lodash": "^4.14.182",
Expand Down
Loading

1 comment on commit 39e2338

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report for apps/ligretto-gameplay-backend

St.
Category Percentage Covered / Total
🔴 Statements 48.63% 373/767
🔴 Branches 24.53% 26/106
🔴 Functions 26.07% 55/211
🔴 Lines 46.27% 310/670

Test suite run success

12 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from 39e2338

Please sign in to comment.