dev: remove netlify (#4014)
This commit is contained in:
parent
8000abaf0e
commit
0f8b1e2570
3
.github/workflows/post-release.yml
vendored
3
.github/workflows/post-release.yml
vendored
@ -33,9 +33,6 @@ jobs:
|
|||||||
- name: Update Contributors list
|
- name: Update Contributors list
|
||||||
run: make update_contributors_list # may take 15 min
|
run: make update_contributors_list # may take 15 min
|
||||||
|
|
||||||
- name: Update netlify state hash
|
|
||||||
run: make update_netlify_state
|
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v5
|
uses: peter-evans/create-pull-request@v5
|
||||||
with:
|
with:
|
||||||
|
2
Makefile
2
Makefile
@ -108,5 +108,3 @@ expand_website_templates:
|
|||||||
update_contributors_list:
|
update_contributors_list:
|
||||||
cd .github/contributors && npm run all
|
cd .github/contributors && npm run all
|
||||||
|
|
||||||
update_netlify_state:
|
|
||||||
go run ./scripts/expand_website_templates/main.go -only-state
|
|
||||||
|
@ -4,8 +4,7 @@ title: Website architecture
|
|||||||
|
|
||||||
## Technology
|
## Technology
|
||||||
|
|
||||||
We use [Gatsby](https://www.gatsbyjs.org/) for static site generation because sites built with it
|
We use [Gatsby](https://www.gatsbyjs.org/) for static site generation because sites built with it are very fast.
|
||||||
are very fast.
|
|
||||||
|
|
||||||
This framework uses React and JavaScript/TypeScript.
|
This framework uses React and JavaScript/TypeScript.
|
||||||
|
|
||||||
@ -16,9 +15,8 @@ The website lives in `docs/` directory of [golangci-lint repository](https://git
|
|||||||
## Theme
|
## Theme
|
||||||
|
|
||||||
Initially the site is based on [@rocketseat](https://rocketdocs.netlify.app/) theme.
|
Initially the site is based on [@rocketseat](https://rocketdocs.netlify.app/) theme.
|
||||||
Later we've merged it's code into `src/@rocketseat` because we needed too much changes
|
Later we've merged its code into `src/@rocketseat` because we needed too much changes
|
||||||
and [gatsby shadowing](https://www.gatsbyjs.org/docs/themes/shadowing/) doesn't
|
and [gatsby shadowing](https://www.gatsbyjs.org/docs/themes/shadowing/) doesn't allow shadowing `gatsby-node.js` or `gatsby-config.js`.
|
||||||
allow shadowing `gatsby-node.js` or `gatsby-config.js`.
|
|
||||||
|
|
||||||
## Navigation
|
## Navigation
|
||||||
|
|
||||||
@ -31,22 +29,15 @@ allowing to use `React` components.
|
|||||||
|
|
||||||
## Templating
|
## Templating
|
||||||
|
|
||||||
We use templates like `{.SomeField}` inside our `mdx` files. There templates are expanded
|
We use templates like `{.SomeField}` inside our `mdx` files.
|
||||||
by running `make expand_website_templates` in the root of the repository.
|
There templates are expanded by running `make expand_website_templates` in the root of the repository.
|
||||||
It runs script `scripts/expand_website_templates/main.go` that rewrites `mdx` files with replaced templates.
|
It runs script `scripts/expand_website_templates/main.go` that rewrites `mdx` files with replaced templates.
|
||||||
|
|
||||||
## CDN and DNS
|
|
||||||
|
|
||||||
We use [CloudFlare](https://www.cloudflare.com/) for CDN, proxying and DNS management.
|
|
||||||
|
|
||||||
## Hosting
|
## Hosting
|
||||||
|
|
||||||
We use [Netlify](https://www.netlify.com/) as static website hosting and CD.
|
We use GitHub Pages as static website hosting and CD.
|
||||||
It's integrated into our pull requests: if `docs/` directory has changes Netlify
|
|
||||||
will trigger website rebuild and deploy it's preview for a branch. You can view
|
|
||||||
it to ensure that everything ok.
|
|
||||||
|
|
||||||
Netlify deploys the website to production after merging anything to a `master` branch.
|
GitHub deploys the website to production after merging anything to a `master` branch.
|
||||||
|
|
||||||
## Local Testing
|
## Local Testing
|
||||||
|
|
||||||
@ -61,16 +52,10 @@ And navigate to `http://localhost:8000` after successful Gatsby build.
|
|||||||
There is no need to restart Gatsby server almost for all changes: it supports hot reload.
|
There is no need to restart Gatsby server almost for all changes: it supports hot reload.
|
||||||
Also, there is no need to refresh a webpage: hot reload updates changed content on the open page.
|
Also, there is no need to refresh a webpage: hot reload updates changed content on the open page.
|
||||||
|
|
||||||
## Trigger Website Rebuild
|
## Website Build
|
||||||
|
|
||||||
Currently, Netlify triggers rebuild only if anything has changes in `docs/` directory.
|
To do it run:
|
||||||
But we can add a new linter and need to change a documentation to list the linter.
|
|
||||||
|
|
||||||
To do it run
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
go run ./scripts/expand_website_templates/main.go -only-state
|
go run ./scripts/expand_website_templates/main.go
|
||||||
```
|
```
|
||||||
|
|
||||||
It saves a hash of template replacements (that include all linters, configs, etc)
|
|
||||||
into `docs/template_data.state`.
|
|
||||||
|
@ -4,8 +4,7 @@ title: Contributing Workflow
|
|||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
By participating to this project, you agree to abide our [code of
|
By participating in this project, you agree to abide our [code of conduct](https://github.com/golangci/golangci-lint/blob/master/CODE_OF_CONDUCT.md).
|
||||||
conduct](https://github.com/golangci/golangci-lint/blob/master/CODE_OF_CONDUCT.md).
|
|
||||||
|
|
||||||
## Set up your machine
|
## Set up your machine
|
||||||
|
|
||||||
@ -46,8 +45,7 @@ Push your branch to your `golangci-lint` fork and open a pull request against th
|
|||||||
|
|
||||||
## Pull request checks
|
## Pull request checks
|
||||||
|
|
||||||
First, please, accept [CLA](https://gist.github.com/jirfag/26a39fd375da84b2d5ad4296fecb0668) - [cla assistant](https://cla-assistant.io/) will
|
First, please, accept [CLA](https://gist.github.com/jirfag/26a39fd375da84b2d5ad4296fecb0668) - [cla assistant](https://cla-assistant.io/) will make a comment on the pull request about it.
|
||||||
make a comment on the pull request about it.
|
|
||||||
|
|
||||||
Also, we run a few checks in CI by using GitHub actions, you can see them [here](https://github.com/golangci/golangci-lint/blob/master/.github/workflows/pr.yml).
|
Also, we run a few checks in CI by using GitHub actions, you can see them [here](https://github.com/golangci/golangci-lint/blob/master/.github/workflows/pr.yml).
|
||||||
|
|
||||||
@ -61,19 +59,11 @@ A GitHub action [workflow](https://github.com/golangci/golangci-lint/blob/master
|
|||||||
After making a release you need to update:
|
After making a release you need to update:
|
||||||
|
|
||||||
1. GitHub [action config](https://github.com/golangci/golangci-lint/blob/master/assets/github-action-config.json) by running:
|
1. GitHub [action config](https://github.com/golangci/golangci-lint/blob/master/assets/github-action-config.json) by running:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make assets/github-action-config.json
|
make assets/github-action-config.json
|
||||||
```
|
```
|
||||||
|
|
||||||
2. The latest netlify state (e.g. docs/template_date.state):
|
2. Contributors list:
|
||||||
|
|
||||||
```sh
|
|
||||||
make update_netlify_state
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Contributors list
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make update_contributors_list # may take 15 min
|
make update_contributors_list # may take 15 min
|
||||||
```
|
```
|
||||||
|
1
docs/static/CNAME
vendored
Normal file
1
docs/static/CNAME
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
golangci-lint.run
|
@ -1,2 +0,0 @@
|
|||||||
This file stores hash of website templates to trigger Netlify rebuild when something changes, e.g. new linter is added.
|
|
||||||
3dd55e7301e3b3c9fab930bcc28a44db056ccefa15befc5a360e764d1aad1d48
|
|
23
netlify.toml
23
netlify.toml
@ -1,23 +0,0 @@
|
|||||||
[context.production.environment]
|
|
||||||
GO_VERSION = "1.19"
|
|
||||||
NODE_VERSION = "17"
|
|
||||||
# TODO https://github.com/golangci/golangci-lint/pull/2904#issuecomment-1146870535
|
|
||||||
# NPM_FLAGS = "--legacy-peer-deps"
|
|
||||||
# NPM_FLAGS = "--force"
|
|
||||||
NPM_VERSION = "8.5.5"
|
|
||||||
|
|
||||||
[context.deploy-preview.environment]
|
|
||||||
GO_VERSION = "1.19"
|
|
||||||
NODE_VERSION = "17"
|
|
||||||
# TODO https://github.com/golangci/golangci-lint/pull/2904#issuecomment-1146870535
|
|
||||||
# NPM_FLAGS = "--legacy-peer-deps"
|
|
||||||
# NPM_FLAGS = "--force"
|
|
||||||
NPM_VERSION = "8.5.5"
|
|
||||||
|
|
||||||
[context.branch-deploy.environment]
|
|
||||||
GO_VERSION = "1.19"
|
|
||||||
NODE_VERSION = "17"
|
|
||||||
# TODO https://github.com/golangci/golangci-lint/pull/2904#issuecomment-1146870535
|
|
||||||
# NPM_FLAGS = "--legacy-peer-deps"
|
|
||||||
# NPM_FLAGS = "--force"
|
|
||||||
NPM_VERSION = "8.5.5"
|
|
@ -2,10 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/sha256"
|
|
||||||
"encoding/hex"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
@ -29,50 +26,19 @@ import (
|
|||||||
|
|
||||||
const listItemPrefix = "list-item-"
|
const listItemPrefix = "list-item-"
|
||||||
|
|
||||||
var stateFilePath = filepath.Join("docs", "template_data.state")
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var onlyWriteState bool
|
|
||||||
flag.BoolVar(&onlyWriteState, "only-state", false, fmt.Sprintf("Only write hash of state to %s and exit", stateFilePath))
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
replacements, err := buildTemplateContext()
|
replacements, err := buildTemplateContext()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to build template context: %s", err)
|
log.Fatalf("Failed to build template context: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = updateStateFile(replacements); err != nil {
|
|
||||||
log.Fatalf("Failed to update state file: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if onlyWriteState {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := rewriteDocs(replacements); err != nil {
|
if err := rewriteDocs(replacements); err != nil {
|
||||||
log.Fatalf("Failed to rewrite docs: %s", err)
|
log.Fatalf("Failed to rewrite docs: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Print("Successfully expanded templates")
|
log.Print("Successfully expanded templates")
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateStateFile(replacements map[string]string) error {
|
|
||||||
replBytes, err := json.Marshal(replacements)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to json marshal replacements: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
h := sha256.New()
|
|
||||||
if _, err := h.Write(replBytes); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
contentBuf := bytes.NewBufferString("This file stores hash of website templates to trigger " +
|
|
||||||
"Netlify rebuild when something changes, e.g. new linter is added.\n")
|
|
||||||
contentBuf.WriteString(hex.EncodeToString(h.Sum(nil)))
|
|
||||||
|
|
||||||
return renameio.WriteFile(stateFilePath, contentBuf.Bytes(), os.ModePerm)
|
|
||||||
}
|
|
||||||
|
|
||||||
func rewriteDocs(replacements map[string]string) error {
|
func rewriteDocs(replacements map[string]string) error {
|
||||||
madeReplacements := map[string]bool{}
|
madeReplacements := map[string]bool{}
|
||||||
err := filepath.Walk(filepath.Join("docs", "src", "docs"),
|
err := filepath.Walk(filepath.Join("docs", "src", "docs"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user