diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 5b53ab39c7fc..8cf3c46a8927 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -33,9 +33,6 @@ jobs: - name: Update Contributors list run: make update_contributors_list # may take 15 min - - name: Update netlify state hash - run: make update_netlify_state - - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: diff --git a/Makefile b/Makefile index 92f3580e74a4..b3939327ddc4 100644 --- a/Makefile +++ b/Makefile @@ -108,5 +108,3 @@ expand_website_templates: update_contributors_list: cd .github/contributors && npm run all -update_netlify_state: - go run ./scripts/expand_website_templates/main.go -only-state diff --git a/docs/src/docs/contributing/website.mdx b/docs/src/docs/contributing/website.mdx index b56757850ff7..4b538767755f 100644 --- a/docs/src/docs/contributing/website.mdx +++ b/docs/src/docs/contributing/website.mdx @@ -4,8 +4,7 @@ title: Website architecture ## Technology -We use [Gatsby](https://www.gatsbyjs.org/) for static site generation because sites built with it -are very fast. +We use [Gatsby](https://www.gatsbyjs.org/) for static site generation because sites built with it are very fast. This framework uses React and JavaScript/TypeScript. @@ -16,9 +15,8 @@ The website lives in `docs/` directory of [golangci-lint repository](https://git ## 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 -and [gatsby shadowing](https://www.gatsbyjs.org/docs/themes/shadowing/) doesn't -allow shadowing `gatsby-node.js` or `gatsby-config.js`. +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 allow shadowing `gatsby-node.js` or `gatsby-config.js`. ## Navigation @@ -31,22 +29,15 @@ allowing to use `React` components. ## Templating -We use templates like `{.SomeField}` inside our `mdx` files. There templates are expanded -by running `make expand_website_templates` in the root of the repository. +We use templates like `{.SomeField}` inside our `mdx` files. +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. -## CDN and DNS - -We use [CloudFlare](https://www.cloudflare.com/) for CDN, proxying and DNS management. - ## Hosting -We use [Netlify](https://www.netlify.com/) 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. +We use GitHub Pages as static website hosting and CD. -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 @@ -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. 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. -But we can add a new linter and need to change a documentation to list the linter. - -To do it run +To do it run: ```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`. diff --git a/docs/src/docs/contributing/workflow.mdx b/docs/src/docs/contributing/workflow.mdx index a6e8531a6d66..a5eb63c58b79 100644 --- a/docs/src/docs/contributing/workflow.mdx +++ b/docs/src/docs/contributing/workflow.mdx @@ -4,10 +4,9 @@ title: Contributing Workflow # Contributing -By participating to this project, you agree to abide our [code of -conduct](https://github.com/golangci/golangci-lint/blob/master/CODE_OF_CONDUCT.md). +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). -## Setup your machine +## Set up your machine `golangci-lint` is written in [Go](https://go.dev). @@ -46,8 +45,7 @@ Push your branch to your `golangci-lint` fork and open a pull request against th ## Pull request checks -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. +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. 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: 1. GitHub [action config](https://github.com/golangci/golangci-lint/blob/master/assets/github-action-config.json) by running: - ```sh make assets/github-action-config.json ``` -2. The latest netlify state (e.g. docs/template_date.state): - -```sh -make update_netlify_state -``` - -3. Contributors list - +2. Contributors list: ```sh make update_contributors_list # may take 15 min ``` diff --git a/docs/static/CNAME b/docs/static/CNAME new file mode 100644 index 000000000000..6c92bff7c490 --- /dev/null +++ b/docs/static/CNAME @@ -0,0 +1 @@ +golangci-lint.run diff --git a/docs/template_data.state b/docs/template_data.state deleted file mode 100755 index 321f539d7cd7..000000000000 --- a/docs/template_data.state +++ /dev/null @@ -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 \ No newline at end of file diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index dcd0c45f1cf1..000000000000 --- a/netlify.toml +++ /dev/null @@ -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" diff --git a/scripts/expand_website_templates/main.go b/scripts/expand_website_templates/main.go index 0e38900f23b8..bb5e83015c43 100644 --- a/scripts/expand_website_templates/main.go +++ b/scripts/expand_website_templates/main.go @@ -2,10 +2,7 @@ package main import ( "bytes" - "crypto/sha256" - "encoding/hex" "encoding/json" - "flag" "fmt" "io" "log" @@ -29,48 +26,17 @@ import ( const listItemPrefix = "list-item-" -var stateFilePath = filepath.Join("docs", "template_data.state") - 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() if err != nil { 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 { log.Fatalf("Failed to rewrite docs: %s", err) } - 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) + log.Print("Successfully expanded templates") } func rewriteDocs(replacements map[string]string) error {