You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +02:00 
			
		
		
		
	docs: improve build (#3674)
- generate releases.json et al on our github actions workflow - use those when building and also on our `run` script - new releases will dispatch the workflow so it re-generates the needed files Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							2ae0eaf4dd
						
					
				
				
					commit
					232c982fb0
				
			
							
								
								
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							| @@ -7,3 +7,5 @@ | ||||
|  | ||||
| www/docs/static/schema.json linguist-generated=true | ||||
| www/docs/static/schema-pro.json linguist-generated=true | ||||
| www/docs/static/releases.json linguist-generated=true | ||||
| www/docs/static/releases-pro.json linguist-generated=true | ||||
|   | ||||
							
								
								
									
										2
									
								
								.github/workflows/generate.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/generate.yml
									
									
									
									
										vendored
									
									
								
							| @@ -9,6 +9,7 @@ on: | ||||
|       - pkg/config/config.go | ||||
|       - CONTRIBUTING.md | ||||
|       - USERS.md | ||||
|   workflow_dispatch: | ||||
|  | ||||
| permissions: | ||||
|   contents: read | ||||
| @@ -28,6 +29,7 @@ jobs: | ||||
|           cache: true | ||||
|       - uses: arduino/setup-task@d665c6beebae46ff3f699d7b2fd3f1959de7153c # v1 | ||||
|       - run: task docs:generate | ||||
|       - run: task docs:releases | ||||
|       - run: task schema:generate | ||||
|       - uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a # v4 | ||||
|         with: | ||||
|   | ||||
							
								
								
									
										13
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| @@ -13,12 +13,21 @@ permissions: | ||||
|   packages: write | ||||
|  | ||||
| jobs: | ||||
|   trigger-generate: | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: [ goreleaser ] | ||||
|     steps: | ||||
|       - uses: benc-uk/workflow-dispatch@v1 | ||||
|         with: | ||||
|           repo: goreleaser/goreleaser | ||||
|           ref: main | ||||
|           token: ${{ secrets.GH_PAT }} | ||||
|           workflow: generate.yml | ||||
|   goreleaser-check-pkgs: | ||||
|     runs-on: ubuntu-latest | ||||
|     env: | ||||
|       DOCKER_CLI_EXPERIMENTAL: "enabled" | ||||
|     needs: | ||||
|       - goreleaser | ||||
|     needs: [ goreleaser ] | ||||
|     if: github.ref == 'refs/heads/main' | ||||
|     strategy: | ||||
|       matrix: | ||||
|   | ||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -6,7 +6,6 @@ goreleaser | ||||
| debug.test | ||||
| snap.login | ||||
| site/ | ||||
| www/docs/static/releases*.json | ||||
| .vercel | ||||
| completions/ | ||||
| .vscode/ | ||||
|   | ||||
							
								
								
									
										10
									
								
								Taskfile.yml
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Taskfile.yml
									
									
									
									
									
								
							| @@ -94,6 +94,16 @@ tasks: | ||||
|       - www/docs/eula.md | ||||
|       - www/docs/security.md | ||||
|  | ||||
|   docs:releases: | ||||
|     desc: Generate docs | ||||
|     cmds: | ||||
|       - ./scripts/get-releases.sh | ||||
|     generates: | ||||
|       - www/docs/static/releases.json | ||||
|       - www/docs/static/releases-pro.json | ||||
|       - www/docs/static/latest | ||||
|       - www/docs/static/latest-pro | ||||
|  | ||||
|   docs:imgs: | ||||
|     desc: Download and resize images | ||||
|     cmds: | ||||
|   | ||||
| @@ -15,18 +15,23 @@ generate() { | ||||
| 	last_page="$(get_last_page "$url")" | ||||
| 	tmp="$(mktemp -d)" | ||||
|  | ||||
| 	for i in $(seq 1 "$last_page"); do | ||||
| 	for i in $(seq -w 1 "$last_page"); do | ||||
| 		echo "page: $i" | ||||
| 		curl -H "Authorization: Bearer $GITHUB_TOKEN" -sSf "$url?page=$i" | jq 'map({tag_name: .tag_name})' >"$tmp/$i.json" | ||||
| 	done | ||||
|  | ||||
| 	if test "$last_page" -eq "1"; then | ||||
| 		cp -f "$tmp"/1.json "$file" | ||||
| 	else | ||||
| 		jq --compact-output -s 'add' "$tmp"/*.json >"$file" | ||||
| 	fi | ||||
| 	jq -s 'add' "$tmp"/*.json >"$file" | ||||
| 	du -hs "$file" | ||||
| } | ||||
|  | ||||
| latest() { | ||||
| 	local url="$1" | ||||
| 	local file="$2" | ||||
| 	curl -sfL "$url/latest" | jq -r ".tag_name" >"$file" | ||||
| 	du -hs "$file" | ||||
| } | ||||
|  | ||||
| latest "https://api.github.com/repos/goreleaser/goreleaser/releases" "www/docs/static/latest" | ||||
| latest "https://api.github.com/repos/goreleaser/goreleaser-pro/releases" "www/docs/static/latest-pro" | ||||
| generate "https://api.github.com/repos/goreleaser/goreleaser/releases" "www/docs/static/releases.json" | ||||
| generate "https://api.github.com/repos/goreleaser/goreleaser-pro/releases" "www/docs/static/releases-pro.json" | ||||
|   | ||||
| @@ -6,8 +6,7 @@ pip install --upgrade pip | ||||
| pip install -U mkdocs-material mkdocs-redirects mkdocs-minify-plugin lunr | ||||
|  | ||||
| # prepare | ||||
| ./scripts/get-releases.sh | ||||
| version="$(curl -sSf -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/goreleaser/goreleaser/releases/latest" | jq -r '.tag_name')" | ||||
| version="$(cat ./www/docs/static/latest)" | ||||
| sed -s'' -i "s/__VERSION__/$version/g" www/docs/install.md | ||||
|  | ||||
| # build | ||||
|   | ||||
							
								
								
									
										1
									
								
								www/docs/static/latest
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								www/docs/static/latest
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| v1.14.0 | ||||
							
								
								
									
										1
									
								
								www/docs/static/latest-pro
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								www/docs/static/latest-pro
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| v1.14.0-pro | ||||
							
								
								
									
										221
									
								
								www/docs/static/releases-pro.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										221
									
								
								www/docs/static/releases-pro.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,221 @@ | ||||
| [ | ||||
|   { | ||||
|     "tag_name": "v1.14.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.13.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.13.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.12.3-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.12.2-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.12.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.12.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "nightly" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.11.5-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.11.4-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.11.3-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.11.2-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.11.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.11.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.10.3-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.10.2-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.10.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.10.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.9.2-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.9.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.9.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.8.3-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.8.2-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.8.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.8.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.7.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.6.3-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.6.2-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.6.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.6.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.5.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.4.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.4.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.3.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.3.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.2.5-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.2.4-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.2.3-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.2.2-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.2.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.2.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.1.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v1.0.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.184.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.183.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.182.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.182.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.181.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.181.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.180.3-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.180.2-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.180.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.180.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.179.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.178.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.177.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.176.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.175.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.174.2-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.174.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.174.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.173.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.173.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.172.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.172.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.171.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.171.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.170.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.169.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.168.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.167.0-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.166.1-pro" | ||||
|   }, | ||||
|   { | ||||
|     "tag_name": "v0.166.0-pro" | ||||
|   } | ||||
| ] | ||||
							
								
								
									
										1529
									
								
								www/docs/static/releases.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1529
									
								
								www/docs/static/releases.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										7
									
								
								www/docs/static/run
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								www/docs/static/run
									
									
									
									
										vendored
									
									
								
							| @@ -5,16 +5,15 @@ if test "$DISTRIBUTION" = "pro"; then | ||||
| 	echo "Using Pro distribution..." | ||||
| 	RELEASES_URL="https://github.com/goreleaser/goreleaser-pro/releases" | ||||
| 	FILE_BASENAME="goreleaser-pro" | ||||
| 	LATEST="$(curl -sf https://goreleaser.com/static/latest-pro)" | ||||
| else | ||||
| 	echo "Using the OSS distribution..." | ||||
| 	RELEASES_URL="https://github.com/goreleaser/goreleaser/releases" | ||||
| 	FILE_BASENAME="goreleaser" | ||||
| 	LATEST="$(curl -sf https://goreleaser.com/static/latest)" | ||||
| fi | ||||
|  | ||||
| test -z "$VERSION" && VERSION="$(curl -sfL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" | | ||||
| 		rev | | ||||
| 		cut -f1 -d'/'| | ||||
| 		rev)" | ||||
| test -z "$VERSION" && VERSION="$LATEST" | ||||
|  | ||||
| test -z "$VERSION" && { | ||||
| 	echo "Unable to get goreleaser version." >&2 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user