introduce

Most of us have been working on projects, and when code is pushed to Git or SVN, we can see our project online in real time after a few minutes, as if we were our own son, but most of us don’t know how to do this (if you do, you don’t have to look down, Just like it and go eat…) , so today I’m going to introduce you to one of them, Travis -CI, remember its face:

The core idea of Continuous integration is that the code automates test cases and then integrates into the trunk. It subdivides into two concepts:

  • Continuous delivery
  • Continuous deployment

In short, continuous deployment is the next step in continuous delivery, which is the test phase, and deployment is the test pass phase. There’s a lot going on here. Please, I’ll tell you…

To prepare

  • GitHub account (as a qualified programmer, you don’t really good?)
  • Travis-ci platform access
  • GITHUB_TOKEN
  • Give me a thumbs up…

The first step

Log in to CI’s official website and then connect to your gitHub. Legacy Services Integration should display several of your gitHub projects by defaultIf the display is incomplete, you can press Sync on the leftNext to each project in the first image is a switch switch. You can turn on whichever integration you want.

The second step

Personal Access Tokens GitHub Settings -> Developer Settings -> Personal Access Tokens

Copy the generated token for later use

The third step

Go back to CI and open Settings for the project you switched on. Enter the configuration page and fill in the following contents in Environment Variables:

Git project, project branch (my branch is gh-Pages), token, git-email, git-username

The fourth step

Configure a file named.travis. Yml in the root directory of the project. Package the project using vue-CLI as an example.

Node_js: - '8.9.1' # S: Build Lifecycle install: -npm install script: -Npm run build # after_script: - cd ./dist - git init - git config user.name "${USER_NAME}" - git config user.email "${USER_EMAIL}" - git add . - git commit -m "nicecoders.github.io" - git push --force --quiet "https://${test_token}@${GH_REF}" master:${P_BRANCH} # E: Build LifeCycle # Execute branches: only: -masterCopy the code

Step four and five

Open CI, enter the page where I build the project, open job log, and feel the pleasure of fear of error! (Tears…)

Of course if you pass, there will be a passing next to the title of your project.

Every time I see this I get teary-eyed…

Step 5

Take a look at your project on Git. Does this branch appear and have been automatically deployed? Successful screenshot.

Deployed page

Afterword.

Now you can push your code like crazy and leave the rest to CI.

Well, after so much coding, shouldn’t you:

Point a praise?

A praise?

Praise?

👍

Nicecoders. Github. IO