Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: refine ci #964

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@ name: Config
on: workflow_call

jobs:
config:
if: ${{ github.ref_name == 'main' || github.ref_name == 'develop'}}
name: Config Sync
sync:
runs-on: ubuntu-latest
env:
changes_exist: 'false'
steps:
- name: Checkout code
id: checkout-code
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
fetch-depth: 2
- name: Run script
run: |
yarn config:check
run: yarn config:check
- name: Generate latest env vars
run: |
yarn config:env
run: yarn config:env
- name: Configure git
run: |
git config --global user.name "turtlesocks-bot"
Expand All @@ -33,5 +31,5 @@ jobs:
if: ${{ env.changes_exist == 'true' }}
run: |
git add --all
git commit --message "chore: Sync Config [skip ci]"
git commit --message "chore: Sync Config"
git push
8 changes: 4 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
Docker:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.1
- name: Set .gitsha
if: github.event_name == 'push'
run: 'echo ${{github.sha}} > .gitsha'
run: 'echo ${{ github.sha }} > .gitsha'
- name: Set .gitref
if: github.event_name == 'push'
run: 'echo ${{github.ref}} > .gitref'
run: 'echo ${{ github.ref }} > .gitref'

- name: Log in to the Container registry
uses: docker/login-action@v2
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
name: Lint
on: [push, pull_request]
on: workflow_call

jobs:
lint:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
name: Lint Check
run:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
id: checkout-code
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
fetch-depth: 2
- name: Setup Node.js environment
uses: actions/setup-node@v4
uses: actions/setup-node@v4.0.2
with:
node-version: 20
cache: 'yarn'
cache: yarn

- name: Install Dependencies
run: yarn
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/locales.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,23 @@ on: workflow_call
permissions: write-all

jobs:
locales:
sync:
if: ${{ github.ref_name == 'main' }}
name: Locales Sync
runs-on: ubuntu-latest
env:
changes_exist: 'false'
steps:
- name: Checkout code
id: checkout-code
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
fetch-depth: 2
- name: Install dependencies
run: |
yarn
run: yarn
- name: Run generating script
run: |
yarn locales:generate
run: yarn locales:generate
env:
OPENAI_API_KEY: ${{secrets.OPENAI_API_KEY}}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- name: Configure git
run: |
git config --global user.name "turtlesocks-bot"
Expand All @@ -39,7 +38,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add --all
git commit --message "chore: sync locales [skip ci]"
git commit --message "chore: sync locales"
git push
git checkout develop
git merge main
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
name: Main CI
on: [push, pull_request]
on:
push:
branches:
- main
- develop

jobs:
lint:
uses: ./.github/workflows/lint.yml
config:
uses: ./.github/workflows/config.yml
locales:
uses: ./.github/workflows/locales.yml
release:
uses: ./.github/workflows/release.yml
needs: [config, locales]
if: always()
uses: ./.github/workflows/release.yml
needs: [config, locales, lint]
docker:
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository) && always()
if: always()
uses: ./.github/workflows/docker.yml
needs: [config, locales]
needs: [config, locales, lint]
9 changes: 9 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Pull Request
on: pull_request

jobs:
lint:
uses: ./.github/workflows/lint.yml
docker:
if: github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/docker.yml
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ on: workflow_call
permissions: write-all

jobs:
release:
run:
if: ${{ github.ref_name == 'main' || github.ref_name == 'develop'}}
name: GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Install Volta
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/sentry.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
name: Sentry
on:
release:
types: [created, published]
types: [created, published, prereleased, released]

jobs:
sentry:
name: Sentry
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
id: checkout-code
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
fetch-depth: 2
- name: Setup Node.js environment
uses: actions/setup-node@v3
uses: actions/setup-node@v4.0.2
with:
node-version: 18
cache: 'yarn'
node-version: 20
cache: yarn

- name: Install Dependencies
run: yarn

- name: Sentry Build
run: yarn release
env:
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
SENTRY_DSN: ${{secrets.SENTRY_DSN}}
SENTRY_ORG: ${{secrets.SENTRY_ORG}}
SENTRY_PROJECT: ${{secrets.SENTRY_PROJECT}}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
1 change: 1 addition & 0 deletions packages/config/lib/scripts/genEnvConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs')
const { resolve } = require('path')

const sourceConfig = require('../../../../server/src/configs/default.json')

const camelToSnake = (str) =>
Expand Down
Loading