Commit d7c54ada authored by Thibaud-Vdb's avatar Thibaud-Vdb
Browse files

Merge branch '593-new-job-netlify-deploy' into 'latest'

Resolve "[New job] - Netlify Deploy"

Closes #593

See merge request r2devops/hub!365
parents 40969b9c 52a92fb4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
# Changelog
All notable changes to this job will be documented in this file.

## [0.1.0] - yyyy-mm-dd
* Initial version
 No newline at end of file
+36 −0
Original line number Diff line number Diff line
## Objective

Deploy your front-end application to [Netlify](https://netlify.com). It is an all-in-one platform for automating modern web projects. Replace your hosting infrastructure, continuous integration, and deployment pipeline with a single workflow.   
See the [documentation](https://docs.netlify.com/) for more information.

## How to use it

1. Copy the job URL located in the `Install` part of the right panel and add it inside the `include` list of your `.gitlab-ci.yml` file (see the [quick setup](/use-the-hub/#quick-setup)). You can specify [a fixed version](#changelog) instead of `latest`.
1. If you need to customize the job (stage, variables, ...) 👉 check the [jobs
   customization](/use-the-hub/#jobs-customization)
1. Well done, your job is ready to work ! 😀

## Job details

* Job name: `netlify_deploy`
* Docker image:
[`node:18-buster`](https://hub.docker.com/r/_/node)
* Default stage: `deploy`
* When: `always`

### Variables

| Name | Description | Default |
| ---- | ----------- | ------- |
| `NETLIFY_AUTH_TOKEN` <img width=100/> | ⚠️ Mandatory variable. The authentication token of the user. This variable should be specified in `Gitlab > CI/CD Settings`. <img width=175/>| ` ` <img width=100/>|
| `NETLIFY_SITE_ID` | ⚠️ Mandatory variable. The site id. This variable should be specified in `Gitlab > CI/CD Settings`. | ` ` |
| `NETLIFY_BUILD_DIRECTORY` | Directory to deploy | `build` |
| `NETLIFY_CLI_VERSION` | The version of Netlify CLI | `10.5.0` |

!!! info
    A token can be generated on Netlify in the section `User settings > Applications`, see the [documentation](https://docs.netlify.com/cli/get-started/#obtain-a-token-in-the-netlify-ui). Or you could create one via the command [`netlify login`](https://docs.netlify.com/cli/get-started/#obtain-a-token-in-the-netlify-ui).  
    A deployment can be created from the dashboard or with the command [`netlify init`](https://docs.netlify.com/cli/get-started/#automated-setup).


### Author
This resource is an **[official job](https://docs.r2devops.io/faq-labels/)** added in [**R2Devops repository**](https://gitlab.com/r2devops/hub) by [@GridexX](https://gitlab.com/GridexX)
 No newline at end of file
+14 −0
Original line number Diff line number Diff line
stages:
  - deploy

netlify_deploy:
  image: node:18-buster
  stage: deploy
  variables:
    NETLIFY_AUTH_TOKEN: ""
    NETLIFY_SITE_ID: ""
    NETLIFY_BUILD_DIRECTORY: "build"
    NETLIFY_CLI_VERSION: "10.5.0"
  script:
    - npm i -g netlify-cli@${NETLIFY_CLI_VERSION}
    - netlify deploy --site ${NETLIFY_SITE_ID} --auth ${NETLIFY_AUTH_TOKEN} --prod --dir ${NETLIFY_BUILD_DIRECTORY}
+0 −0

Empty file added.