VueJS build deployment history

Viewed 101

I'm using VueJS 2 in my project and I realized that my build deployment is bad.

This is my script to deploy my VueJS build on github :

#!/usr/bin/env sh

# abort on errors
set -e

# build
cd ../..
VUE_APP_ENV=demo vue-cli-service build

# navigate into the build output directory
cd dist

git init
git add -A
git commit -m 'deploy'

git push -f git@github.com:MyRepo/my-project.git master:my-project-demo-deployment

cd -
rm -rf dist/

After that, I go to my remote server and I get the new build with this command: git pull origin --rebase I'm using this command because I don't have git history so I can't pull. Each time the build is deleted because I delete the dist/ folder.

But this way to deploy my build on remote server is not very good because I can't easily come back to a previous commit because I have one and only commit each time I build/push.

I want to know if there is a solution to deploy all my different builds on the github to do normally git pull my new build on the remote server. I have to edit my script but I don't know what is the best solution. Maybe I have to create another repo to store all my build commits ? I don't know. I hope you can help me.

1 Answers

Here is a side project that I started few weeks ago, pretty much nothing done yet (just configuration). But you can see that:

  • I do have access to a domain name out of the box: https://cyrielle-design.netlify.app
  • it is plugged to my private Github repo: github.com/kissu/free-cyrielle-front
  • I have 3 deploys: initial one + add netlify gitignore + build: add new fancy package + config

enter image description here

If I click on one of those builds, I can have access to a few settings, one of which is a "Deploy site", aka a rollback to a previous build.

enter image description here

So yeah, it's not an answer to your question directly but I felt that it was nice to speak about a platform that will help your heavily on your deployment process.


I'm not sponsored or whatever, but I can give some of my opinions on it.

There are plugins that allow you to use some backend features easily (lambda functions + forms), you have true analytics, split testing, auth, it's managing the whole cache invalidation for you, and a lot of great things. And it will probably stay in the free tier until you really start to have some serious company business with a lot of traffic IMO.

Vercel is another great alternative. I know that you can also host on Firebase or even Digitalocean and Cloudflare now. But I do use Netlify and it is probably the most simple solution for frontend apps as of right now (pretty much the Heroku equivalent).

Related