Merge pull request #52 from archem-team/pre-production

Pre production
This commit is contained in:
Abron Studio
2025-05-19 14:37:34 +03:30
committed by GitHub
3 changed files with 88 additions and 50 deletions

View File

@@ -1,2 +1,2 @@
VITE_API_URL=__API_URL__ VITE_API_URL=https://pro.peptide.chat/api
VITE_THEMES_URL=https://themes.revolt.chat VITE_THEMES_URL=https://themes.revolt.chat

View File

@@ -4,6 +4,7 @@ on:
push: push:
branches: branches:
- "master" - "master"
- "pre-production"
tags: tags:
- "*" - "*"
paths-ignore: paths-ignore:
@@ -18,6 +19,7 @@ on:
pull_request: pull_request:
branches: branches:
- "master" - "master"
- "pre-production"
paths-ignore: paths-ignore:
- ".github/**" - ".github/**"
- "!.github/workflows/docker.yml" - "!.github/workflows/docker.yml"
@@ -30,39 +32,39 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
test: # test:
runs-on: ubuntu-latest # runs-on: ubuntu-latest
strategy: # strategy:
matrix: # matrix:
architecture: [linux/amd64] # architecture: [linux/amd64]
steps: # steps:
- name: Checkout # - name: Checkout
uses: actions/checkout@v2 # uses: actions/checkout@v2
with: # with:
submodules: "recursive" # submodules: "recursive"
- name: Set up QEMU # - name: Set up QEMU
uses: docker/setup-qemu-action@v1 # uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx # - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 # uses: docker/setup-buildx-action@v1
- name: Cache Docker layers # - name: Cache Docker layers
uses: actions/cache@v2 # uses: actions/cache@v2
with: # with:
path: /tmp/.buildx-cache/${{ matrix.architecture }} # path: /tmp/.buildx-cache/${{ matrix.architecture }}
key: ${{ runner.os }}-buildx-${{ matrix.architecture }}-${{ github.sha }} # key: ${{ runner.os }}-buildx-${{ matrix.architecture }}-${{ github.sha }}
- name: Build # - name: Build
uses: docker/build-push-action@v2 # uses: docker/build-push-action@v2
with: # with:
context: . # context: .
platforms: ${{ matrix.architecture }} # platforms: ${{ matrix.architecture }}
cache-from: type=local,src=/tmp/.buildx-cache/${{ matrix.architecture }} # cache-from: type=local,src=/tmp/.buildx-cache/${{ matrix.architecture }}
cache-to: type=local,dest=/tmp/.buildx-cache-new/${{ matrix.architecture }},mode=max # cache-to: type=local,dest=/tmp/.buildx-cache-new/${{ matrix.architecture }},mode=max
- name: Move cache # - name: Move cache
run: | # run: |
rm -rf /tmp/.buildx-cache/${{ matrix.architecture }} # rm -rf /tmp/.buildx-cache/${{ matrix.architecture }}
mv /tmp/.buildx-cache-new/${{ matrix.architecture }} /tmp/.buildx-cache/${{ matrix.architecture }} # mv /tmp/.buildx-cache-new/${{ matrix.architecture }} /tmp/.buildx-cache/${{ matrix.architecture }}
publish: publish:
needs: [test] # needs: [test]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
steps: steps:
@@ -75,7 +77,7 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Cache amd64 Docker layers - name: Cache amd64 Docker layers
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: /tmp/.buildx-cache/linux/amd64 path: /tmp/.buildx-cache/linux/amd64
key: ${{ runner.os }}-buildx-linux/amd64-${{ github.sha }} key: ${{ runner.os }}-buildx-linux/amd64-${{ github.sha }}
@@ -83,18 +85,20 @@ jobs:
id: meta id: meta
uses: docker/metadata-action@v3 uses: docker/metadata-action@v3
with: with:
images: revoltchat/client, ghcr.io/revoltchat/client images: ghcr.io/abronstudio/revolt-revite-pre
- name: Login to DockerHub tags: |
uses: docker/login-action@v1 type=raw,value=${{ github.sha }}
with: # - name: Login to DockerHub
username: ${{ secrets.DOCKERHUB_USERNAME }} # uses: docker/login-action@v1
password: ${{ secrets.DOCKERHUB_TOKEN }} # with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Github Container Registry - name: Login to Github Container Registry
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: teamabron
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Build and publish - name: Build and publish
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
@@ -103,9 +107,43 @@ jobs:
platforms: linux/amd64 platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache/linux/amd64 # cache-from: type=local,src=/tmp/.buildx-cache/linux/amd64
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max # cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache # - name: Move cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
deploy:
needs: [publish]
runs-on: ubuntu-latest
env:
CONFIG_BRANCH: main
CLONE_DIR: $GITHUB_WORKSPACE/config
CONFIG_FILE: $GITHUB_WORKSPACE/config/apps/pepchat/kustomization.yaml
if: github.event_name != 'pull_request'
steps:
- name: Checkout Configuration Repository
run: | run: |
rm -rf /tmp/.buildx-cache echo "Cloning configuration repository"
mv /tmp/.buildx-cache-new /tmp/.buildx-cache mkdir -p $CLONE_DIR
git clone -b $CONFIG_BRANCH ${{ secrets.K8_CONFIG_REPO }} $CLONE_DIR
- name: Set Up Git Identity
run: |
cd $CLONE_DIR
git config user.email "ci@example.com"
git config user.name "CI Bot"
- name: Update Image Tag in kustomization.yaml
run: |
awk -v value=" newTag: ${{ github.sha }}" '{sub(/^ newTag: .*/, value); print}' $CONFIG_FILE > temp.yml && mv temp.yml $CONFIG_FILE
awk -v value=" newName: ghcr.io/abronstudio/revolt-revite-pre" '{sub(/^ newName: .*/, value); print}' $CONFIG_FILE > temp.yml && mv temp.yml $CONFIG_FILE
- name: Commit & Push Changes
run: |
cd $CLONE_DIR
git add .
git commit -am "Update image tag to ${{ github.sha }}"
git push origin $CONFIG_BRANCH

View File

@@ -1,8 +1,8 @@
FROM node:16-buster AS builder FROM node:16-buster AS builder
ENV NODE_OPTIONS="--max_old_space_size=16384"
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY ./revolt-revite . COPY . .
COPY ./revolt-revite/.env.build ./revolt-revite/.env COPY .env.build ./.env
RUN yarn install --frozen-lockfile RUN yarn install --frozen-lockfile
RUN yarn build:deps RUN yarn build:deps