Skip to content

Commit

Permalink
Merge pull request #1010 from ninoseki/renew-ci
Browse files Browse the repository at this point in the history
refactor: use Rake as much as possible
  • Loading branch information
ninoseki authored Jan 13, 2024
2 parents dfe284f + f2a0b1b commit 1f8b6da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,6 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: frontend/package-lock.json
# Build YAML format Swagger doc
- name: Build Swagger doc
run: bundle exec rake build:swagger
# Build ReDoc docs & buld the frontend assets
- name: Buld frontend
run: |
npm install
npm run docs
npm run build-only
working-directory: frontend
# Copy the frontend assets into lib
- name: Copy forntend assets
run: |
mkdir -p lib/mihari/web/public/
cp -r frontend/dist/* lib/mihari/web/public
- name: Configure Git
run: |
git config --global user.name "${GITHUB_ACTOR}"
Expand Down
20 changes: 9 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@ namespace :build do
end
end

def ci?
ENV.fetch("CI", false)
end

unless ci?
task :build do
sh "cd frontend && npm install && npm run build"
sh "rm -rf ./lib/mihari/web/public/"
sh "mkdir -p ./lib/mihari/web/public/"
sh "cp -r frontend/dist/* ./lib/mihari/web/public"
end
task :build do
# Build Swagger dos
Rake::Task["build:swagger"].invoke
# Build ReDocs docs & frontend assets
sh "cd frontend && npm install && npm run docs && npm run build-only"
# Copy built assets into ./lib/web/public/
sh "rm -rf ./lib/mihari/web/public/"
sh "mkdir -p ./lib/mihari/web/public/"
sh "cp -r frontend/dist/* ./lib/mihari/web/public"
end

# require it later enables doing pre-build step (= build the frontend app)
Expand Down

0 comments on commit 1f8b6da

Please sign in to comment.