2021-11-25

Gitlab Ci saving artifacts after running gulp

I am trying to run gulp and save compiled file to artifacts, but i cant make it work.

my gulp file works fine on local..

const process = require('process');
var css = {
  src: process.cwd() + '/app/scss/style.scss',
  dest: process.cwd() +'/public/stylesheets'
};
var gulp = require('gulp');
var sass = require('gulp-sass')(require('sass'));

function buildStyles() {
  return gulp.src(css.src)
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest(css.dest));
};

exports.buildStyles = buildStyles;

This is my .yaml file that passes, but the file my-build is empty

stages:          # List of stages for jobs, and their order of execution
  - build
  - deploy
# This job runs in the build stage, which runs first.
build-job:
  stage: build
  image: node:12.22.6-alpine
  variables:
    TZ: "Europe/Stockholm"
  script:
    - echo "Compiling the code..."
    - mkdir my-build
    - cd my-build
    - npm i
    - npm i --g gulp
    - gulp buildStyles
    - echo "Compile complete."  
  artifacts:
    expire_in: 2 days
    paths: 
       - my-build
  allow_failure: false



deploy-job:      # This job runs in the deploy stage.
  stage: deploy  # It only runs when *both* jobs in the test stage complete successfully.
  script:
    - echo "Deploying application..."
    - echo "Application successfully deployed."


from Recent Questions - Stack Overflow https://ift.tt/3CP6VCs
https://ift.tt/eA8V8J

No comments:

Post a Comment