This is the fourth day of my participation in Gwen Challenge

Create a task and configure the task

A new task

General

Source code management

Generating public and private Keys

Ssh-keygen -t rsa -c "Your email address"Copy the code

If you press Enter three times, the public key ID_rsa. pub and private key ID_rsa are generated in the ~/. SSH file in Linux (cloud server)

cd ~/.ssh
cat id_rsa.pub
Copy the code

1. Copy the returned public key value and add it to the SSH key on Github

cat id_rsa
Copy the code

2. Copy the returned private key value, add it to the Credentials, and click Add

3. Select the Credentials on the Credentials screen.

Build trigger

Build environment

1. Add Webhook (select from Settings of your current project)

Click on add

Since our goal is to automate the build after the push, we only need the push event to test the connection after we add it

2. Install nodejs

Search the optional plugins for NodeJS Plugin to install and restart Jenkins

And then to

3. Configure tasks

build

Node -v NPM -v NPM install&& # install NPM run docs:build #build packageCopy the code

Build and packaging is inside the Jenkins server, you write this part in building all the command line, although in the/var/lib/Jenkins/workspace/name of your tasks for the operation of the path, the shell can only in the case of Jenkins as ~, The Jenkins server (/var/lib/jenkins/) in the cloud is the only thing the shell script can handle. And then you can save it directly.

Perform task test

Click Build Now to test.

You can view console output during each test for quick error location.

Modify the Nginx pointing

Just point Nginx to the static files that are packed in Jenkins’ workspace each time.

/ var/lib/Jenkins/workspace/vuepress run underCopy the code

So is/var/lib/Jenkins/workspace/vuepress/public (static folder here each project is different, I this is public, have a plenty of dist).

VSCode commits and pushes

  1. Clone the Github repository locally (skip this step if you already have the repository locally)

    Execute in the folder you want to save

    Git clone https://github.com/ username /xxx.gitCopy the code

    File directory

    -- the folder where you executed the command -- the XXX folder (which you cloned from)Copy the code

    Every time you write the article, just put it directly under the classification. Just place it anywhere in your local clone folder on github or you make changes and vscode will alert you

  2. Submit, and the following shows the files or folders you have modified or added

  3. As prompted, you need to fill in your submission information and press Enter to submit.

  4. Push to your remote Github repository, aka Push