Roudi
Roudi

Reputation: 1319

Bitbucket Pipeline + Firebase hosting

I am trying to integrate Bitbucket pipeline with firebase hosting to achieve continuous delivery. Everything seems to work fine until it's required to deploy the public folder.

Here's my 'bitbucket-pipelines.yml':

image: gabrielaraujof/angular-cli

pipelines:
  default:
    - step:
        caches:
          - node
        script: # Modify the commands below to build your repository.
          - npm install
          - npm build
          - firebase deploy --token=$FIREBASE_TOKEN --project MT_PROJECT --only hosting --public dist

Where npm build runs "ng build". When i run the "firebase deploy.." command on my local machine it works fine cause the dist directory is there. But when it's run by Bitbucket Pipeline it throws this error:

=== Deploying to MY_PROJECT...
i  deploying hosting
Error: Specified public directory does not exist, can't deploy hosting

It seems like the bitbucket pipeline does not generate the dist folder which firebase deploy is trying to find (dist).

Upvotes: 1

Views: 2488

Answers (1)

Roudi
Roudi

Reputation: 1319

For anyone looking for an answer, this worked for me:

image: node:7.4.0

pipelines:
  default:
    - step:
        caches:
          - node
        script:
            - npm install -g @angular/cli
            - npm install -g firebase-tools
            - npm install
            - ng build
            - firebase deploy --only hosting --token "$FIREBASE_TOKEN" --public dist

Upvotes: 2

Related Questions