preface

In the previous two chapters, we have completed the environment setup, project construction, which is local operation, after all these are completed, we will proceed to our final step, send to the server. It’s not much, but I think it should be a chapter on its own.

Install Publish Over FTP

Search the plugin library and install it

Global Settings

You can also use the key to connect, but it is not recommended to use the account and password to connect

Click Test Configuration to Test successful connection. If “Success” is displayed, the connection is successful.

Project Settings

Go to the previous project configuration and click On post-Build options

Select the file to build on the publisher

Add the corresponding configuration information in the open configuration item. Here I will do a detailed explanation:

Source files: This is the address of the file you want to upload. The address here is relative to the directory address of your current task. The front-end usually sends files in dist directory, so you can write dist/** directly, which means all contents in dist directory

Remove Prefix: This is a path clipping thing, which is important, at least for the front end

Remote directory: the address of the server directory that you want to pass in. This is a concatenated address. This address plus the global address configured previously is the complete directory for the final work

I use an example to illustrate, directory is my task. Jenkins/workspace/myItem, so my Source files is dist / * *, the server directory to/WWW/htdocs/myItem, so I Remote / WWW /htdocs/ is the global configuration of SSH. If you try it once, you will find that it has uploaded the entire dist directory, so we need to use Remove If prefix is configured, add dist to Remove prefix. If this directory is discarded, only the content in dist directory will be uploaded. At this point, the upload step is completed.

Is there a notification system? Jenkins has email notification, but we’re more of a pin guy, so I’m going to show you how to add a pin guy

Install the nail plug-in

Search DingTalk in the optional plugins

After the installation is successful, restart Jenkins

Global configuration

Before global configuration, we need to create a new robot on the nail

The two configurations in the robot match

The webhock and encryption parameters in the global configuration item

After filling in, click test, if successful, then you can see the message in The nail, click Save.

Enter our project configuration

Fill in who you want to @ according to the rules,OK, everything is done, we are ready to form a complete publishing loop.