Skip to content

release: v7.0.5

release: v7.0.5 #464

Workflow file for this run

on:
push:
tags:
- 'v*'
name: Release (core)
jobs:
build:
name: Main Build
runs-on: ubuntu-22.04
outputs:
release_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.11.0
with:
mongodb-version: 4.4
- name: Start Redis
uses: supercharge/redis-github-action@1.8.0
with:
redis-version: 6
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
version:
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Cache pnpm modules
uses: actions/cache@v4
env:
cache-name: cache-pnpm-modules
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install Dependencies
run: |
pnpm i
- name: Build project
run: |
pnpm run bundle
- name: Test Bundle Server
run: |
bash scripts/workflow/test-server.sh
- name: Zip Assets
run: |
sh apps/core/zip-asset.sh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
draft: false
prerelease: ${{ contains(fromJSON('["alpha", "beta"]'), github.ref_name) }}
- run: npx changelogithub
continue-on-error: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release.zip
asset_name: release-linux.zip
asset_content_type: application/zip
deploy:
name: Deploy To Remote Server
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: robinraju/release-downloader@v1.11
name: Download release
with:
tag: ${{ github.ref_name }}
fileName: 'release-linux.zip'
- name: copy file via ssh password
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
# port: ${{ secrets.PORT }}
key: ${{ secrets.KEY }}
source: 'release-linux.zip'
target: '/tmp/mx-core'
- name: Exec deploy script with SSH
uses: appleboy/ssh-action@master
env:
JWTSECRET: ${{ secrets.JWTSECRET }}
MX_ENCRYPT_KEY: ${{ secrets.MX_ENCRYPT_KEY }}
with:
command_timeout: 5m
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
key: ${{ secrets.KEY }}
envs: JWTSECRET,MX_ENCRYPT_KEY
script_stop: true
script: |
whoami
cd
source ~/.zshrc
cd mx
ls -a
node server-deploy.js --jwtSecret=$JWTSECRET --encrypt_key=$MX_ENCRYPT_KEY --encrypt_enable --scp_path=/tmp/mx-core/release-linux.zip
docker:
name: Docker Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
arch: ['amd64', 'arm64']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
innei/mx-server
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Copy .env
run: |
cp .env.example .env
- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }},innei/mx-server:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: |
bash ./scripts/workflow/test-docker.sh
sudo rm -rf ./data
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}