From a03c549c3f1d4c32dcc84fe7aa0738f7b005cf3d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 8 Jan 2024 15:07:59 -0300 Subject: [PATCH] feat: generar assets --- .gitlab-ci.yml | 18 ++---------------- Makefile | 8 -------- Taskfile.yaml | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8994356..2c576305 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,27 +7,13 @@ cache: - "vendor/ruby" assets: stage: "build" - rules: - - if: "$CI_COMMIT_BRANCH == \"panel.sutty.nl\"" - - if: "$CI_COMMIT_BRANCH" - changes: - compare_to: "refs/heads/rails" - paths: - - "package.json" - - "app/javascript/**/*" - - "app/assets/**/*" before_script: - "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\"" - "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\"" - "git remote set-url --push origin \"https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"" - - "apk add python2 dotenv brotli" - - "mv config/credentials.yml.enc.ci config/credentials.yml.enc" - - "cp .env.example .env" - - "dotenv bundle install --path=vendor" + - "apk add dotenv brotli go-task" script: - - "dotenv RAILS_ENV=production bundle exec rails webpacker:clobber" - - "dotenv RAILS_ENV=production bundle exec rails assets:precompile" - - "dotenv RAILS_ENV=production bundle exec rails assets:clean" + - "go-task assets" after_script: - "git add public && git commit -m \"ci: assets [skip ci]\"" - "git push -o ci.skip" diff --git a/Makefile b/Makefile index 541d072b..9a70a1af 100644 --- a/Makefile +++ b/Makefile @@ -117,12 +117,4 @@ $(tests): always @grep -q " panel.$(SUTTY)$$" $@ || echo -e "127.0.0.1 panel.$(SUTTY)\n::1 panel.$(SUTTY)" | sudo tee -a $@ @grep -q " postgresql.$(SUTTY)$$" $@ || echo -e "127.0.0.1 postgresql.$(SUTTY)\n::1 postgresql.$(SUTTY)" | sudo tee -a $@ -# Instala las dependencias de Javascript -node_modules: package.json - $(MAKE) yarn - -# Instala las dependencias de Rails -Gemfile.lock: Gemfile - $(MAKE) bundle args=install - .PHONY: always diff --git a/Taskfile.yaml b/Taskfile.yaml index 1204b1a5..4f524707 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -50,3 +50,21 @@ tasks: - "yarn.lock" status: - "test -d node_modules" + assets: + desc: "Generate assets" + deps: + - "node-modules" + - "gems" + cmds: + - "git lfs fetch" + - "git lfs checkout" + - "haini.sh RAILS_ENV=production bundle exec rails webpacker:clobber" + - "haini.sh RAILS_ENV=production bundle exec rails assets:precompile" + - "haini.sh RAILS_ENV=production bundle exec rails assets:clean" + sources: + - "package.json" + - "yarn.lock" + - "app/assets/**/*" + - "app/javascript/**/*" + generates: + - "public/packs/manifest.json"