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.json linguist-generated=true | ||||||
| www/docs/static/schema-pro.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 |       - pkg/config/config.go | ||||||
|       - CONTRIBUTING.md |       - CONTRIBUTING.md | ||||||
|       - USERS.md |       - USERS.md | ||||||
|  |   workflow_dispatch: | ||||||
|  |  | ||||||
| permissions: | permissions: | ||||||
|   contents: read |   contents: read | ||||||
| @@ -28,6 +29,7 @@ jobs: | |||||||
|           cache: true |           cache: true | ||||||
|       - uses: arduino/setup-task@d665c6beebae46ff3f699d7b2fd3f1959de7153c # v1 |       - uses: arduino/setup-task@d665c6beebae46ff3f699d7b2fd3f1959de7153c # v1 | ||||||
|       - run: task docs:generate |       - run: task docs:generate | ||||||
|  |       - run: task docs:releases | ||||||
|       - run: task schema:generate |       - run: task schema:generate | ||||||
|       - uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a # v4 |       - uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a # v4 | ||||||
|         with: |         with: | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| @@ -13,12 +13,21 @@ permissions: | |||||||
|   packages: write |   packages: write | ||||||
|  |  | ||||||
| jobs: | 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: |   goreleaser-check-pkgs: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     env: |     env: | ||||||
|       DOCKER_CLI_EXPERIMENTAL: "enabled" |       DOCKER_CLI_EXPERIMENTAL: "enabled" | ||||||
|     needs: |     needs: [ goreleaser ] | ||||||
|       - goreleaser |  | ||||||
|     if: github.ref == 'refs/heads/main' |     if: github.ref == 'refs/heads/main' | ||||||
|     strategy: |     strategy: | ||||||
|       matrix: |       matrix: | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -6,7 +6,6 @@ goreleaser | |||||||
| debug.test | debug.test | ||||||
| snap.login | snap.login | ||||||
| site/ | site/ | ||||||
| www/docs/static/releases*.json |  | ||||||
| .vercel | .vercel | ||||||
| completions/ | completions/ | ||||||
| .vscode/ | .vscode/ | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								Taskfile.yml
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Taskfile.yml
									
									
									
									
									
								
							| @@ -94,6 +94,16 @@ tasks: | |||||||
|       - www/docs/eula.md |       - www/docs/eula.md | ||||||
|       - www/docs/security.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: |   docs:imgs: | ||||||
|     desc: Download and resize images |     desc: Download and resize images | ||||||
|     cmds: |     cmds: | ||||||
|   | |||||||
| @@ -15,18 +15,23 @@ generate() { | |||||||
| 	last_page="$(get_last_page "$url")" | 	last_page="$(get_last_page "$url")" | ||||||
| 	tmp="$(mktemp -d)" | 	tmp="$(mktemp -d)" | ||||||
|  |  | ||||||
| 	for i in $(seq 1 "$last_page"); do | 	for i in $(seq -w 1 "$last_page"); do | ||||||
| 		echo "page: $i" | 		echo "page: $i" | ||||||
| 		curl -H "Authorization: Bearer $GITHUB_TOKEN" -sSf "$url?page=$i" | jq 'map({tag_name: .tag_name})' >"$tmp/$i.json" | 		curl -H "Authorization: Bearer $GITHUB_TOKEN" -sSf "$url?page=$i" | jq 'map({tag_name: .tag_name})' >"$tmp/$i.json" | ||||||
| 	done | 	done | ||||||
|  |  | ||||||
| 	if test "$last_page" -eq "1"; then | 	jq -s 'add' "$tmp"/*.json >"$file" | ||||||
| 		cp -f "$tmp"/1.json "$file" |  | ||||||
| 	else |  | ||||||
| 		jq --compact-output -s 'add' "$tmp"/*.json >"$file" |  | ||||||
| 	fi |  | ||||||
| 	du -hs "$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/releases" "www/docs/static/releases.json" | ||||||
| generate "https://api.github.com/repos/goreleaser/goreleaser-pro/releases" "www/docs/static/releases-pro.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 | pip install -U mkdocs-material mkdocs-redirects mkdocs-minify-plugin lunr | ||||||
|  |  | ||||||
| # prepare | # prepare | ||||||
| ./scripts/get-releases.sh | version="$(cat ./www/docs/static/latest)" | ||||||
| version="$(curl -sSf -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/goreleaser/goreleaser/releases/latest" | jq -r '.tag_name')" |  | ||||||
| sed -s'' -i "s/__VERSION__/$version/g" www/docs/install.md | sed -s'' -i "s/__VERSION__/$version/g" www/docs/install.md | ||||||
|  |  | ||||||
| # build | # 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..." | 	echo "Using Pro distribution..." | ||||||
| 	RELEASES_URL="https://github.com/goreleaser/goreleaser-pro/releases" | 	RELEASES_URL="https://github.com/goreleaser/goreleaser-pro/releases" | ||||||
| 	FILE_BASENAME="goreleaser-pro" | 	FILE_BASENAME="goreleaser-pro" | ||||||
|  | 	LATEST="$(curl -sf https://goreleaser.com/static/latest-pro)" | ||||||
| else | else | ||||||
| 	echo "Using the OSS distribution..." | 	echo "Using the OSS distribution..." | ||||||
| 	RELEASES_URL="https://github.com/goreleaser/goreleaser/releases" | 	RELEASES_URL="https://github.com/goreleaser/goreleaser/releases" | ||||||
| 	FILE_BASENAME="goreleaser" | 	FILE_BASENAME="goreleaser" | ||||||
|  | 	LATEST="$(curl -sf https://goreleaser.com/static/latest)" | ||||||
| fi | fi | ||||||
|  |  | ||||||
| test -z "$VERSION" && VERSION="$(curl -sfL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" | | test -z "$VERSION" && VERSION="$LATEST" | ||||||
| 		rev | |  | ||||||
| 		cut -f1 -d'/'| |  | ||||||
| 		rev)" |  | ||||||
|  |  | ||||||
| test -z "$VERSION" && { | test -z "$VERSION" && { | ||||||
| 	echo "Unable to get goreleaser version." >&2 | 	echo "Unable to get goreleaser version." >&2 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user