build(goreleaser): add goreleaser configuration with dev build support and checksum verification
- commit
- 9ef7342cea57829d95bcf3ea788e59b50f11893f
- author
- bnema · · 2025-10-26 11:14 UTC
- parent
- 5529ae6
- signature
- unsigned
7 files · +411 -20
M .gitignore +5 -0
| @@ -13,11 +13,16 @@ | |||
| 13 | 13 | pkg/ | |
| 14 | 14 | src/ | |
| 15 | 15 | build/ | |
| 16 | + | dist/ | |
| 17 | + | ||
| 18 | + | # Test coverage | |
| 19 | + | coverage.out | |
| 16 | 20 | ||
| 17 | 21 | # Markdown files at root (except README and CHANGELOG) | |
| 18 | 22 | /*.md | |
| 19 | 23 | !README.md | |
| 20 | 24 | !CHANGELOG.md | |
| 25 | + | !RELEASING.md | |
| 21 | 26 | ||
| 22 | 27 | ||
| 23 | 28 | *.qcow2 | |
| @@ -13,11 +13,16 @@ | |||||
| 13 | pkg/ | 13 | pkg/ | ||
| 14 | src/ | 14 | src/ | ||
| 15 | build/ | 15 | build/ | ||
| 16 | + | dist/ | |||
| 17 | + | ||||
| 18 | + | # Test coverage | |||
| 19 | + | coverage.out | |||
| 16 | 20 | ||||
| 17 | # Markdown files at root (except README and CHANGELOG) | 21 | # Markdown files at root (except README and CHANGELOG) | ||
| 18 | /*.md | 22 | /*.md | ||
| 19 | !README.md | 23 | !README.md | ||
| 20 | !CHANGELOG.md | 24 | !CHANGELOG.md | ||
| 25 | + | !RELEASING.md | |||
| 21 | 26 | ||||
| 22 | 27 | ||||
| 23 | *.qcow2 | 28 | *.qcow2 | ||
A .goreleaser.yaml +160 -0
| @@ -0,0 +1,160 @@ | |||
| 1 | + | # GoReleaser configuration for ArchUp installer | |
| 2 | + | # https://goreleaser.com | |
| 3 | + | version: 2 | |
| 4 | + | ||
| 5 | + | before: | |
| 6 | + | hooks: | |
| 7 | + | - go mod tidy | |
| 8 | + | ||
| 9 | + | builds: | |
| 10 | + | # Main build - static binary for Arch Linux ISO | |
| 11 | + | - id: archup-installer | |
| 12 | + | main: ./cmd/archup-installer | |
| 13 | + | binary: archup-installer | |
| 14 | + | ||
| 15 | + | env: | |
| 16 | + | - CGO_ENABLED=0 | |
| 17 | + | ||
| 18 | + | goos: | |
| 19 | + | - linux | |
| 20 | + | ||
| 21 | + | goarch: | |
| 22 | + | - amd64 | |
| 23 | + | ||
| 24 | + | # Version information via ldflags | |
| 25 | + | ldflags: | |
| 26 | + | - -s -w | |
| 27 | + | - -X main.version={{.Version}} | |
| 28 | + | ||
| 29 | + | # Build flags for reproducible builds | |
| 30 | + | flags: | |
| 31 | + | - -trimpath | |
| 32 | + | ||
| 33 | + | archives: | |
| 34 | + | - id: default | |
| 35 | + | name_template: >- | |
| 36 | + | {{ .ProjectName }}_ | |
| 37 | + | {{- .Version }}_ | |
| 38 | + | {{- .Os }}_ | |
| 39 | + | {{- if eq .Arch "amd64" }}x86_64 | |
| 40 | + | {{- else if eq .Arch "386" }}i386 | |
| 41 | + | {{- else }}{{ .Arch }}{{ end }} | |
| 42 | + | format_overrides: | |
| 43 | + | - goos: linux | |
| 44 | + | format: tar.gz | |
| 45 | + | files: | |
| 46 | + | - LICENSE | |
| 47 | + | - README.md | |
| 48 | + | - CHANGELOG.md | |
| 49 | + | - logo.txt | |
| 50 | + | - install.sh | |
| 51 | + | - install/**/* | |
| 52 | + | ||
| 53 | + | checksum: | |
| 54 | + | name_template: 'checksums.txt' | |
| 55 | + | algorithm: sha256 | |
| 56 | + | ||
| 57 | + | snapshot: | |
| 58 | + | version_template: "{{ incpatch .Version }}-next" | |
| 59 | + | ||
| 60 | + | changelog: | |
| 61 | + | sort: asc | |
| 62 | + | use: github | |
| 63 | + | filters: | |
| 64 | + | exclude: | |
| 65 | + | - '^docs:' | |
| 66 | + | - '^test:' | |
| 67 | + | - '^ci:' | |
| 68 | + | - '^chore:' | |
| 69 | + | - '^build\(deps\):' | |
| 70 | + | - 'Merge pull request' | |
| 71 | + | - 'Merge branch' | |
| 72 | + | groups: | |
| 73 | + | - title: 'Features' | |
| 74 | + | regexp: '^feat(\(.+\))?:' | |
| 75 | + | order: 0 | |
| 76 | + | - title: 'Bug Fixes' | |
| 77 | + | regexp: '^fix(\(.+\))?:' | |
| 78 | + | order: 1 | |
| 79 | + | - title: 'Performance' | |
| 80 | + | regexp: '^perf(\(.+\))?:' | |
| 81 | + | order: 2 | |
| 82 | + | - title: 'Refactoring' | |
| 83 | + | regexp: '^refactor(\(.+\))?:' | |
| 84 | + | order: 3 | |
| 85 | + | - title: 'Documentation' | |
| 86 | + | regexp: '^docs(\(.+\))?:' | |
| 87 | + | order: 4 | |
| 88 | + | - title: 'Other Changes' | |
| 89 | + | order: 999 | |
| 90 | + | ||
| 91 | + | release: | |
| 92 | + | github: | |
| 93 | + | owner: bnema | |
| 94 | + | name: archup | |
| 95 | + | ||
| 96 | + | # Don't auto-publish as draft initially | |
| 97 | + | draft: false | |
| 98 | + | ||
| 99 | + | # Replace existing draft if it exists | |
| 100 | + | replace_existing_draft: true | |
| 101 | + | ||
| 102 | + | # Header for release notes | |
| 103 | + | header: | | |
| 104 | + | ## {{.Tag}} Release | |
| 105 | + | ||
| 106 | + | ArchUp installer with Go-based TUI for automated Arch Linux installation. | |
| 107 | + | ||
| 108 | + | Released on {{.Date}} | |
| 109 | + | ||
| 110 | + | # Footer with installation instructions | |
| 111 | + | footer: | | |
| 112 | + | --- | |
| 113 | + | ||
| 114 | + | ## Installation | |
| 115 | + | ||
| 116 | + | ### Quick Install (from Arch Linux ISO) | |
| 117 | + | ```bash | |
| 118 | + | curl -fsSL https://archup.run/install/bin | bash | |
| 119 | + | ``` | |
| 120 | + | ||
| 121 | + | ### Install Pre-release/Dev Version | |
| 122 | + | ```bash | |
| 123 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |
| 124 | + | ``` | |
| 125 | + | ||
| 126 | + | ### Install Specific Version | |
| 127 | + | ```bash | |
| 128 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --version {{.Tag}} | |
| 129 | + | ``` | |
| 130 | + | ||
| 131 | + | ### Manual Install | |
| 132 | + | ```bash | |
| 133 | + | # Download binary | |
| 134 | + | wget https://github.com/bnema/archup/releases/download/{{.Tag}}/archup-installer | |
| 135 | + | ||
| 136 | + | # Verify checksum | |
| 137 | + | wget https://github.com/bnema/archup/releases/download/{{.Tag}}/checksums.txt | |
| 138 | + | sha256sum -c checksums.txt --ignore-missing | |
| 139 | + | ||
| 140 | + | # Install | |
| 141 | + | chmod +x archup-installer | |
| 142 | + | sudo install -m 755 archup-installer /usr/local/bin/ | |
| 143 | + | ``` | |
| 144 | + | ||
| 145 | + | --- | |
| 146 | + | ||
| 147 | + | **Full Changelog**: https://github.com/bnema/archup/compare/{{.PreviousTag}}...{{.Tag}} | |
| 148 | + | ||
| 149 | + | # Auto-detect prerelease from version (v1.0.0-rc1, v1.0.0-alpha, etc.) | |
| 150 | + | prerelease: auto | |
| 151 | + | ||
| 152 | + | # Mark as latest release | |
| 153 | + | make_latest: true | |
| 154 | + | ||
| 155 | + | # Replace existing release notes | |
| 156 | + | mode: replace | |
| 157 | + | ||
| 158 | + | # Also upload standalone binary | |
| 159 | + | extra_files: | |
| 160 | + | - glob: build/archup-installer | |
| @@ -0,0 +1,160 @@ | |||||
| 1 | + | # GoReleaser configuration for ArchUp installer | |||
| 2 | + | # https://goreleaser.com | |||
| 3 | + | version: 2 | |||
| 4 | + | ||||
| 5 | + | before: | |||
| 6 | + | hooks: | |||
| 7 | + | - go mod tidy | |||
| 8 | + | ||||
| 9 | + | builds: | |||
| 10 | + | # Main build - static binary for Arch Linux ISO | |||
| 11 | + | - id: archup-installer | |||
| 12 | + | main: ./cmd/archup-installer | |||
| 13 | + | binary: archup-installer | |||
| 14 | + | ||||
| 15 | + | env: | |||
| 16 | + | - CGO_ENABLED=0 | |||
| 17 | + | ||||
| 18 | + | goos: | |||
| 19 | + | - linux | |||
| 20 | + | ||||
| 21 | + | goarch: | |||
| 22 | + | - amd64 | |||
| 23 | + | ||||
| 24 | + | # Version information via ldflags | |||
| 25 | + | ldflags: | |||
| 26 | + | - -s -w | |||
| 27 | + | - -X main.version={{.Version}} | |||
| 28 | + | ||||
| 29 | + | # Build flags for reproducible builds | |||
| 30 | + | flags: | |||
| 31 | + | - -trimpath | |||
| 32 | + | ||||
| 33 | + | archives: | |||
| 34 | + | - id: default | |||
| 35 | + | name_template: >- | |||
| 36 | + | {{ .ProjectName }}_ | |||
| 37 | + | {{- .Version }}_ | |||
| 38 | + | {{- .Os }}_ | |||
| 39 | + | {{- if eq .Arch "amd64" }}x86_64 | |||
| 40 | + | {{- else if eq .Arch "386" }}i386 | |||
| 41 | + | {{- else }}{{ .Arch }}{{ end }} | |||
| 42 | + | format_overrides: | |||
| 43 | + | - goos: linux | |||
| 44 | + | format: tar.gz | |||
| 45 | + | files: | |||
| 46 | + | - LICENSE | |||
| 47 | + | - README.md | |||
| 48 | + | - CHANGELOG.md | |||
| 49 | + | - logo.txt | |||
| 50 | + | - install.sh | |||
| 51 | + | - install/**/* | |||
| 52 | + | ||||
| 53 | + | checksum: | |||
| 54 | + | name_template: 'checksums.txt' | |||
| 55 | + | algorithm: sha256 | |||
| 56 | + | ||||
| 57 | + | snapshot: | |||
| 58 | + | version_template: "{{ incpatch .Version }}-next" | |||
| 59 | + | ||||
| 60 | + | changelog: | |||
| 61 | + | sort: asc | |||
| 62 | + | use: github | |||
| 63 | + | filters: | |||
| 64 | + | exclude: | |||
| 65 | + | - '^docs:' | |||
| 66 | + | - '^test:' | |||
| 67 | + | - '^ci:' | |||
| 68 | + | - '^chore:' | |||
| 69 | + | - '^build\(deps\):' | |||
| 70 | + | - 'Merge pull request' | |||
| 71 | + | - 'Merge branch' | |||
| 72 | + | groups: | |||
| 73 | + | - title: 'Features' | |||
| 74 | + | regexp: '^feat(\(.+\))?:' | |||
| 75 | + | order: 0 | |||
| 76 | + | - title: 'Bug Fixes' | |||
| 77 | + | regexp: '^fix(\(.+\))?:' | |||
| 78 | + | order: 1 | |||
| 79 | + | - title: 'Performance' | |||
| 80 | + | regexp: '^perf(\(.+\))?:' | |||
| 81 | + | order: 2 | |||
| 82 | + | - title: 'Refactoring' | |||
| 83 | + | regexp: '^refactor(\(.+\))?:' | |||
| 84 | + | order: 3 | |||
| 85 | + | - title: 'Documentation' | |||
| 86 | + | regexp: '^docs(\(.+\))?:' | |||
| 87 | + | order: 4 | |||
| 88 | + | - title: 'Other Changes' | |||
| 89 | + | order: 999 | |||
| 90 | + | ||||
| 91 | + | release: | |||
| 92 | + | github: | |||
| 93 | + | owner: bnema | |||
| 94 | + | name: archup | |||
| 95 | + | ||||
| 96 | + | # Don't auto-publish as draft initially | |||
| 97 | + | draft: false | |||
| 98 | + | ||||
| 99 | + | # Replace existing draft if it exists | |||
| 100 | + | replace_existing_draft: true | |||
| 101 | + | ||||
| 102 | + | # Header for release notes | |||
| 103 | + | header: | | |||
| 104 | + | ## {{.Tag}} Release | |||
| 105 | + | ||||
| 106 | + | ArchUp installer with Go-based TUI for automated Arch Linux installation. | |||
| 107 | + | ||||
| 108 | + | Released on {{.Date}} | |||
| 109 | + | ||||
| 110 | + | # Footer with installation instructions | |||
| 111 | + | footer: | | |||
| 112 | + | --- | |||
| 113 | + | ||||
| 114 | + | ## Installation | |||
| 115 | + | ||||
| 116 | + | ### Quick Install (from Arch Linux ISO) | |||
| 117 | + | ```bash | |||
| 118 | + | curl -fsSL https://archup.run/install/bin | bash | |||
| 119 | + | ``` | |||
| 120 | + | ||||
| 121 | + | ### Install Pre-release/Dev Version | |||
| 122 | + | ```bash | |||
| 123 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |||
| 124 | + | ``` | |||
| 125 | + | ||||
| 126 | + | ### Install Specific Version | |||
| 127 | + | ```bash | |||
| 128 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --version {{.Tag}} | |||
| 129 | + | ``` | |||
| 130 | + | ||||
| 131 | + | ### Manual Install | |||
| 132 | + | ```bash | |||
| 133 | + | # Download binary | |||
| 134 | + | wget https://github.com/bnema/archup/releases/download/{{.Tag}}/archup-installer | |||
| 135 | + | ||||
| 136 | + | # Verify checksum | |||
| 137 | + | wget https://github.com/bnema/archup/releases/download/{{.Tag}}/checksums.txt | |||
| 138 | + | sha256sum -c checksums.txt --ignore-missing | |||
| 139 | + | ||||
| 140 | + | # Install | |||
| 141 | + | chmod +x archup-installer | |||
| 142 | + | sudo install -m 755 archup-installer /usr/local/bin/ | |||
| 143 | + | ``` | |||
| 144 | + | ||||
| 145 | + | --- | |||
| 146 | + | ||||
| 147 | + | **Full Changelog**: https://github.com/bnema/archup/compare/{{.PreviousTag}}...{{.Tag}} | |||
| 148 | + | ||||
| 149 | + | # Auto-detect prerelease from version (v1.0.0-rc1, v1.0.0-alpha, etc.) | |||
| 150 | + | prerelease: auto | |||
| 151 | + | ||||
| 152 | + | # Mark as latest release | |||
| 153 | + | make_latest: true | |||
| 154 | + | ||||
| 155 | + | # Replace existing release notes | |||
| 156 | + | mode: replace | |||
| 157 | + | ||||
| 158 | + | # Also upload standalone binary | |||
| 159 | + | extra_files: | |||
| 160 | + | - glob: build/archup-installer | |||
M Makefile.go +0 -10
| @@ -42,16 +42,6 @@ build-static: | |||
| 42 | 42 | CGO_ENABLED=0 go build $(GOFLAGS) $(LDFLAGS) -a -installsuffix cgo -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR) | |
| 43 | 43 | @echo "Static build complete: $(BUILD_DIR)/$(BINARY_NAME)" | |
| 44 | 44 | ||
| 45 | - | ## build-tiny: Build with TinyGo for minimal binary size (requires Go 1.19-1.24) | |
| 46 | - | build-tiny: | |
| 47 | - | @echo "Building with TinyGo $(BINARY_NAME) $(VERSION)..." | |
| 48 | - | @mkdir -p $(BUILD_DIR) | |
| 49 | - | @which tinygo > /dev/null || (echo "TinyGo not installed. Install from: https://tinygo.org/getting-started/install/" && exit 1) | |
| 50 | - | @echo "NOTE: TinyGo requires system Go version 1.19-1.24. Current: $$(go version | awk '{print $$3}')" | |
| 51 | - | tinygo build -o $(BUILD_DIR)/$(BINARY_NAME)-tiny $(LDFLAGS) ./$(CMD_DIR) || (echo "TinyGo build failed. System Go version incompatible or packages not supported." && exit 1) | |
| 52 | - | @echo "TinyGo build complete: $(BUILD_DIR)/$(BINARY_NAME)-tiny" | |
| 53 | - | @ls -lh $(BUILD_DIR)/$(BINARY_NAME)-tiny | |
| 54 | - | ||
| 55 | 45 | ## install: Install the binary to system | |
| 56 | 46 | install: build | |
| 57 | 47 | @echo "Installing $(BINARY_NAME) to $(INSTALL_DIR)..." | |
| @@ -42,16 +42,6 @@ build-static: | |||||
| 42 | CGO_ENABLED=0 go build $(GOFLAGS) $(LDFLAGS) -a -installsuffix cgo -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR) | 42 | CGO_ENABLED=0 go build $(GOFLAGS) $(LDFLAGS) -a -installsuffix cgo -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR) | ||
| 43 | @echo "Static build complete: $(BUILD_DIR)/$(BINARY_NAME)" | 43 | @echo "Static build complete: $(BUILD_DIR)/$(BINARY_NAME)" | ||
| 44 | 44 | ||||
| 45 | - | ## build-tiny: Build with TinyGo for minimal binary size (requires Go 1.19-1.24) | |||
| 46 | - | build-tiny: | |||
| 47 | - | @echo "Building with TinyGo $(BINARY_NAME) $(VERSION)..." | |||
| 48 | - | @mkdir -p $(BUILD_DIR) | |||
| 49 | - | @which tinygo > /dev/null || (echo "TinyGo not installed. Install from: https://tinygo.org/getting-started/install/" && exit 1) | |||
| 50 | - | @echo "NOTE: TinyGo requires system Go version 1.19-1.24. Current: $$(go version | awk '{print $$3}')" | |||
| 51 | - | tinygo build -o $(BUILD_DIR)/$(BINARY_NAME)-tiny $(LDFLAGS) ./$(CMD_DIR) || (echo "TinyGo build failed. System Go version incompatible or packages not supported." && exit 1) | |||
| 52 | - | @echo "TinyGo build complete: $(BUILD_DIR)/$(BINARY_NAME)-tiny" | |||
| 53 | - | @ls -lh $(BUILD_DIR)/$(BINARY_NAME)-tiny | |||
| 54 | - | ||||
| 55 | ## install: Install the binary to system | 45 | ## install: Install the binary to system | ||
| 56 | install: build | 46 | install: build | ||
| 57 | @echo "Installing $(BINARY_NAME) to $(INSTALL_DIR)..." | 47 | @echo "Installing $(BINARY_NAME) to $(INSTALL_DIR)..." | ||
M README.md +22 -2
| @@ -33,12 +33,32 @@ We learned from Omarchy's excellent modular approach but rejected the bloat. Arc | |||
| 33 | 33 | ||
| 34 | 34 | ## Quick Start | |
| 35 | 35 | ||
| 36 | - | **Requirements**: AMD/Intel 64-bit system | |
| 36 | + | **Requirements**: AMD/Intel 64-bit system, UEFI mode | |
| 37 | + | ||
| 38 | + | ### Go-based Installer (Recommended) | |
| 39 | + | ||
| 40 | + | Interactive TUI with configuration preview and better error handling: | |
| 41 | + | ||
| 42 | + | ```bash | |
| 43 | + | # 1. Boot Arch ISO, run installer | |
| 44 | + | curl -fsSL https://archup.run/install/bin | bash | |
| 45 | + | ||
| 46 | + | # Install dev/pre-release version | |
| 47 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |
| 48 | + | ||
| 49 | + | # 2. Reboot into new system | |
| 50 | + | ||
| 51 | + | # 3. Run wizard to add desktop (optional) | |
| 52 | + | archup wizard | |
| 53 | + | ``` | |
| 54 | + | ||
| 55 | + | ### Legacy Bash Installer | |
| 56 | + | ||
| 57 | + | Simple script-based installer: | |
| 37 | 58 | ||
| 38 | 59 | ```bash | |
| 39 | 60 | # 1. Boot Arch ISO, install barebone system | |
| 40 | 61 | curl -fsSL https://archup.run/install | sh | |
| 41 | - | # or shorter: curl -fsSL https://archup.run/i | sh | |
| 42 | 62 | ||
| 43 | 63 | # 2. Reboot into new system | |
| 44 | 64 | ||
| @@ -33,12 +33,32 @@ We learned from Omarchy's excellent modular approach but rejected the bloat. Arc | |||||
| 33 | 33 | ||||
| 34 | ## Quick Start | 34 | ## Quick Start | ||
| 35 | 35 | ||||
| 36 | - | **Requirements**: AMD/Intel 64-bit system | 36 | + | **Requirements**: AMD/Intel 64-bit system, UEFI mode |
| 37 | + | ||||
| 38 | + | ### Go-based Installer (Recommended) | |||
| 39 | + | ||||
| 40 | + | Interactive TUI with configuration preview and better error handling: | |||
| 41 | + | ||||
| 42 | + | ```bash | |||
| 43 | + | # 1. Boot Arch ISO, run installer | |||
| 44 | + | curl -fsSL https://archup.run/install/bin | bash | |||
| 45 | + | ||||
| 46 | + | # Install dev/pre-release version | |||
| 47 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |||
| 48 | + | ||||
| 49 | + | # 2. Reboot into new system | |||
| 50 | + | ||||
| 51 | + | # 3. Run wizard to add desktop (optional) | |||
| 52 | + | archup wizard | |||
| 53 | + | ``` | |||
| 54 | + | ||||
| 55 | + | ### Legacy Bash Installer | |||
| 56 | + | ||||
| 57 | + | Simple script-based installer: | |||
| 37 | 58 | ||||
| 38 | ```bash | 59 | ```bash | ||
| 39 | # 1. Boot Arch ISO, install barebone system | 60 | # 1. Boot Arch ISO, install barebone system | ||
| 40 | curl -fsSL https://archup.run/install | sh | 61 | curl -fsSL https://archup.run/install | sh | ||
| 41 | - | # or shorter: curl -fsSL https://archup.run/i | sh | |||
| 42 | 62 | ||||
| 43 | # 2. Reboot into new system | 63 | # 2. Reboot into new system | ||
| 44 | 64 | ||||
A RELEASING.md +146 -0
| @@ -0,0 +1,146 @@ | |||
| 1 | + | # Release Process | |
| 2 | + | ||
| 3 | + | This document describes how to create releases for ArchUp using goreleaser. | |
| 4 | + | ||
| 5 | + | ## Prerequisites | |
| 6 | + | ||
| 7 | + | Install goreleaser: | |
| 8 | + | ```bash | |
| 9 | + | # On Arch Linux | |
| 10 | + | sudo pacman -S goreleaser | |
| 11 | + | ||
| 12 | + | # Or with Go | |
| 13 | + | go install github.com/goreleaser/goreleaser/v2@latest | |
| 14 | + | ``` | |
| 15 | + | ||
| 16 | + | ## Release Types | |
| 17 | + | ||
| 18 | + | ### Development/Pre-release Builds | |
| 19 | + | ||
| 20 | + | Development builds are tagged with suffixes like `-dev`, `-rc1`, `-alpha`, `-beta`. | |
| 21 | + | ||
| 22 | + | **Examples:** | |
| 23 | + | - `v0.15.3-dev` | |
| 24 | + | - `v0.16.0-rc1` | |
| 25 | + | - `v0.16.0-alpha` | |
| 26 | + | ||
| 27 | + | These are automatically marked as pre-releases on GitHub and can be installed with: | |
| 28 | + | ```bash | |
| 29 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |
| 30 | + | ``` | |
| 31 | + | ||
| 32 | + | ### Stable Releases | |
| 33 | + | ||
| 34 | + | Stable releases use semantic versioning without suffixes. | |
| 35 | + | ||
| 36 | + | **Examples:** | |
| 37 | + | - `v0.15.3` | |
| 38 | + | - `v1.0.0` | |
| 39 | + | ||
| 40 | + | These are marked as the latest stable release and installed by default: | |
| 41 | + | ```bash | |
| 42 | + | curl -fsSL https://archup.run/install/bin | bash | |
| 43 | + | ``` | |
| 44 | + | ||
| 45 | + | ## Creating a Dev Release | |
| 46 | + | ||
| 47 | + | 1. **Commit your changes:** | |
| 48 | + | ```bash | |
| 49 | + | git add . | |
| 50 | + | git commit -m "feat(installer): add new feature" | |
| 51 | + | ``` | |
| 52 | + | ||
| 53 | + | 2. **Tag the dev version:** | |
| 54 | + | ```bash | |
| 55 | + | git tag v0.15.3-dev | |
| 56 | + | ``` | |
| 57 | + | ||
| 58 | + | 3. **Push the tag:** | |
| 59 | + | ```bash | |
| 60 | + | git push origin v0.15.3-dev | |
| 61 | + | ``` | |
| 62 | + | ||
| 63 | + | 4. **Run goreleaser:** | |
| 64 | + | ```bash | |
| 65 | + | # Ensure you have GITHUB_TOKEN set | |
| 66 | + | export GITHUB_TOKEN="your_github_token" | |
| 67 | + | ||
| 68 | + | # Create the release | |
| 69 | + | goreleaser release --clean | |
| 70 | + | ``` | |
| 71 | + | ||
| 72 | + | The release will be created on GitHub as a pre-release. | |
| 73 | + | ||
| 74 | + | ## Creating a Stable Release | |
| 75 | + | ||
| 76 | + | Same process as dev release, but use a clean version tag: | |
| 77 | + | ||
| 78 | + | ```bash | |
| 79 | + | git tag v0.15.3 | |
| 80 | + | git push origin v0.15.3 | |
| 81 | + | goreleaser release --clean | |
| 82 | + | ``` | |
| 83 | + | ||
| 84 | + | ## Testing Releases Locally | |
| 85 | + | ||
| 86 | + | Before pushing, test the release process locally: | |
| 87 | + | ||
| 88 | + | ```bash | |
| 89 | + | # Test without publishing | |
| 90 | + | goreleaser release --snapshot --skip=publish --clean | |
| 91 | + | ||
| 92 | + | # Check the artifacts in dist/ | |
| 93 | + | ls -lh dist/ | |
| 94 | + | ``` | |
| 95 | + | ||
| 96 | + | ## Testing Installation from VM | |
| 97 | + | ||
| 98 | + | After creating a dev release, test the installation: | |
| 99 | + | ||
| 100 | + | ```bash | |
| 101 | + | # On your Arch Linux VM/ISO | |
| 102 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |
| 103 | + | ``` | |
| 104 | + | ||
| 105 | + | Or test a specific version: | |
| 106 | + | ```bash | |
| 107 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --version v0.15.3-dev | |
| 108 | + | ``` | |
| 109 | + | ||
| 110 | + | ## Artifacts Generated | |
| 111 | + | ||
| 112 | + | Each release creates: | |
| 113 | + | - `archup-installer` - Standalone binary | |
| 114 | + | - `archup_VERSION_linux_x86_64.tar.gz` - Archive with binary + install scripts | |
| 115 | + | - `checksums.txt` - SHA256 checksums for verification | |
| 116 | + | ||
| 117 | + | ## Troubleshooting | |
| 118 | + | ||
| 119 | + | **goreleaser not found:** | |
| 120 | + | ```bash | |
| 121 | + | go install github.com/goreleaser/goreleaser/v2@latest | |
| 122 | + | ``` | |
| 123 | + | ||
| 124 | + | **GITHUB_TOKEN not set:** | |
| 125 | + | Create a personal access token at https://github.com/settings/tokens with `repo` scope: | |
| 126 | + | ```bash | |
| 127 | + | export GITHUB_TOKEN="ghp_your_token_here" | |
| 128 | + | # Or add to ~/.bashrc for persistence | |
| 129 | + | ``` | |
| 130 | + | ||
| 131 | + | **Release failed:** | |
| 132 | + | Check the goreleaser output for errors. Common issues: | |
| 133 | + | - Tag already exists (delete with `git tag -d TAG` and `git push origin :refs/tags/TAG`) | |
| 134 | + | - Invalid version format | |
| 135 | + | - Missing permissions on GitHub token | |
| 136 | + | ||
| 137 | + | ## CI/CD (Future) | |
| 138 | + | ||
| 139 | + | Consider setting up GitHub Actions to automate releases: | |
| 140 | + | ```yaml | |
| 141 | + | # .github/workflows/release.yml | |
| 142 | + | on: | |
| 143 | + | push: | |
| 144 | + | tags: | |
| 145 | + | - 'v*' | |
| 146 | + | ``` | |
| @@ -0,0 +1,146 @@ | |||||
| 1 | + | # Release Process | |||
| 2 | + | ||||
| 3 | + | This document describes how to create releases for ArchUp using goreleaser. | |||
| 4 | + | ||||
| 5 | + | ## Prerequisites | |||
| 6 | + | ||||
| 7 | + | Install goreleaser: | |||
| 8 | + | ```bash | |||
| 9 | + | # On Arch Linux | |||
| 10 | + | sudo pacman -S goreleaser | |||
| 11 | + | ||||
| 12 | + | # Or with Go | |||
| 13 | + | go install github.com/goreleaser/goreleaser/v2@latest | |||
| 14 | + | ``` | |||
| 15 | + | ||||
| 16 | + | ## Release Types | |||
| 17 | + | ||||
| 18 | + | ### Development/Pre-release Builds | |||
| 19 | + | ||||
| 20 | + | Development builds are tagged with suffixes like `-dev`, `-rc1`, `-alpha`, `-beta`. | |||
| 21 | + | ||||
| 22 | + | **Examples:** | |||
| 23 | + | - `v0.15.3-dev` | |||
| 24 | + | - `v0.16.0-rc1` | |||
| 25 | + | - `v0.16.0-alpha` | |||
| 26 | + | ||||
| 27 | + | These are automatically marked as pre-releases on GitHub and can be installed with: | |||
| 28 | + | ```bash | |||
| 29 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |||
| 30 | + | ``` | |||
| 31 | + | ||||
| 32 | + | ### Stable Releases | |||
| 33 | + | ||||
| 34 | + | Stable releases use semantic versioning without suffixes. | |||
| 35 | + | ||||
| 36 | + | **Examples:** | |||
| 37 | + | - `v0.15.3` | |||
| 38 | + | - `v1.0.0` | |||
| 39 | + | ||||
| 40 | + | These are marked as the latest stable release and installed by default: | |||
| 41 | + | ```bash | |||
| 42 | + | curl -fsSL https://archup.run/install/bin | bash | |||
| 43 | + | ``` | |||
| 44 | + | ||||
| 45 | + | ## Creating a Dev Release | |||
| 46 | + | ||||
| 47 | + | 1. **Commit your changes:** | |||
| 48 | + | ```bash | |||
| 49 | + | git add . | |||
| 50 | + | git commit -m "feat(installer): add new feature" | |||
| 51 | + | ``` | |||
| 52 | + | ||||
| 53 | + | 2. **Tag the dev version:** | |||
| 54 | + | ```bash | |||
| 55 | + | git tag v0.15.3-dev | |||
| 56 | + | ``` | |||
| 57 | + | ||||
| 58 | + | 3. **Push the tag:** | |||
| 59 | + | ```bash | |||
| 60 | + | git push origin v0.15.3-dev | |||
| 61 | + | ``` | |||
| 62 | + | ||||
| 63 | + | 4. **Run goreleaser:** | |||
| 64 | + | ```bash | |||
| 65 | + | # Ensure you have GITHUB_TOKEN set | |||
| 66 | + | export GITHUB_TOKEN="your_github_token" | |||
| 67 | + | ||||
| 68 | + | # Create the release | |||
| 69 | + | goreleaser release --clean | |||
| 70 | + | ``` | |||
| 71 | + | ||||
| 72 | + | The release will be created on GitHub as a pre-release. | |||
| 73 | + | ||||
| 74 | + | ## Creating a Stable Release | |||
| 75 | + | ||||
| 76 | + | Same process as dev release, but use a clean version tag: | |||
| 77 | + | ||||
| 78 | + | ```bash | |||
| 79 | + | git tag v0.15.3 | |||
| 80 | + | git push origin v0.15.3 | |||
| 81 | + | goreleaser release --clean | |||
| 82 | + | ``` | |||
| 83 | + | ||||
| 84 | + | ## Testing Releases Locally | |||
| 85 | + | ||||
| 86 | + | Before pushing, test the release process locally: | |||
| 87 | + | ||||
| 88 | + | ```bash | |||
| 89 | + | # Test without publishing | |||
| 90 | + | goreleaser release --snapshot --skip=publish --clean | |||
| 91 | + | ||||
| 92 | + | # Check the artifacts in dist/ | |||
| 93 | + | ls -lh dist/ | |||
| 94 | + | ``` | |||
| 95 | + | ||||
| 96 | + | ## Testing Installation from VM | |||
| 97 | + | ||||
| 98 | + | After creating a dev release, test the installation: | |||
| 99 | + | ||||
| 100 | + | ```bash | |||
| 101 | + | # On your Arch Linux VM/ISO | |||
| 102 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |||
| 103 | + | ``` | |||
| 104 | + | ||||
| 105 | + | Or test a specific version: | |||
| 106 | + | ```bash | |||
| 107 | + | curl -fsSL https://archup.run/install/bin | bash -s -- --version v0.15.3-dev | |||
| 108 | + | ``` | |||
| 109 | + | ||||
| 110 | + | ## Artifacts Generated | |||
| 111 | + | ||||
| 112 | + | Each release creates: | |||
| 113 | + | - `archup-installer` - Standalone binary | |||
| 114 | + | - `archup_VERSION_linux_x86_64.tar.gz` - Archive with binary + install scripts | |||
| 115 | + | - `checksums.txt` - SHA256 checksums for verification | |||
| 116 | + | ||||
| 117 | + | ## Troubleshooting | |||
| 118 | + | ||||
| 119 | + | **goreleaser not found:** | |||
| 120 | + | ```bash | |||
| 121 | + | go install github.com/goreleaser/goreleaser/v2@latest | |||
| 122 | + | ``` | |||
| 123 | + | ||||
| 124 | + | **GITHUB_TOKEN not set:** | |||
| 125 | + | Create a personal access token at https://github.com/settings/tokens with `repo` scope: | |||
| 126 | + | ```bash | |||
| 127 | + | export GITHUB_TOKEN="ghp_your_token_here" | |||
| 128 | + | # Or add to ~/.bashrc for persistence | |||
| 129 | + | ``` | |||
| 130 | + | ||||
| 131 | + | **Release failed:** | |||
| 132 | + | Check the goreleaser output for errors. Common issues: | |||
| 133 | + | - Tag already exists (delete with `git tag -d TAG` and `git push origin :refs/tags/TAG`) | |||
| 134 | + | - Invalid version format | |||
| 135 | + | - Missing permissions on GitHub token | |||
| 136 | + | ||||
| 137 | + | ## CI/CD (Future) | |||
| 138 | + | ||||
| 139 | + | Consider setting up GitHub Actions to automate releases: | |||
| 140 | + | ```yaml | |||
| 141 | + | # .github/workflows/release.yml | |||
| 142 | + | on: | |||
| 143 | + | push: | |||
| 144 | + | tags: | |||
| 145 | + | - 'v*' | |||
| 146 | + | ``` | |||
M go.mod +1 -1
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | module github.com/bnema/archup | |
| 2 | 2 | ||
| 3 | - | go 1.24.0 | |
| 3 | + | go 1.25.3 | |
| 4 | 4 | ||
| 5 | 5 | require ( | |
| 6 | 6 | github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 | |
| @@ -1,6 +1,6 @@ | |||||
| 1 | module github.com/bnema/archup | 1 | module github.com/bnema/archup | ||
| 2 | 2 | ||||
| 3 | - | go 1.24.0 | 3 | + | go 1.25.3 |
| 4 | 4 | ||||
| 5 | require ( | 5 | require ( | ||
| 6 | github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 | 6 | github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 | ||
M install-bin.sh +77 -7
| @@ -1,13 +1,46 @@ | |||
| 1 | 1 | #!/bin/bash | |
| 2 | 2 | # ArchUp Installer Bootstrap Script | |
| 3 | 3 | # Downloads and runs the ArchUp Go installer | |
| 4 | + | # | |
| 5 | + | # Usage: | |
| 6 | + | # curl -fsSL https://archup.run/install/bin | bash | |
| 7 | + | # curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |
| 8 | + | # curl -fsSL https://archup.run/install/bin | bash -s -- --version v0.15.3-dev | |
| 9 | + | # | |
| 10 | + | # Or locally: | |
| 11 | + | # ./install-bin.sh # Install latest stable release | |
| 12 | + | # ./install-bin.sh --dev # Install latest pre-release (dev/rc builds) | |
| 13 | + | # ./install-bin.sh --version v0.15.3-dev # Install specific version | |
| 4 | 14 | ||
| 5 | 15 | set -e | |
| 6 | 16 | ||
| 17 | + | # Parse arguments | |
| 18 | + | DEV_MODE=false | |
| 19 | + | SPECIFIC_VERSION="" | |
| 20 | + | ||
| 21 | + | while [[ $# -gt 0 ]]; do | |
| 22 | + | case $1 in | |
| 23 | + | --dev) | |
| 24 | + | DEV_MODE=true | |
| 25 | + | shift | |
| 26 | + | ;; | |
| 27 | + | --version) | |
| 28 | + | SPECIFIC_VERSION="$2" | |
| 29 | + | shift 2 | |
| 30 | + | ;; | |
| 31 | + | *) | |
| 32 | + | echo "Unknown option: $1" | |
| 33 | + | echo "Usage: $0 [--dev] [--version VERSION]" | |
| 34 | + | exit 1 | |
| 35 | + | ;; | |
| 36 | + | esac | |
| 37 | + | done | |
| 38 | + | ||
| 7 | 39 | # Colors for output | |
| 8 | 40 | RED='\033[0;31m' | |
| 9 | 41 | GREEN='\033[0;32m' | |
| 10 | 42 | BLUE='\033[0;34m' | |
| 43 | + | YELLOW='\033[0;33m' | |
| 11 | 44 | NC='\033[0m' # No Color | |
| 12 | 45 | ||
| 13 | 46 | info() { | |
| @@ -18,6 +51,10 @@ success() { | |||
| 18 | 51 | echo -e "${GREEN}[OK]${NC} $1" | |
| 19 | 52 | } | |
| 20 | 53 | ||
| 54 | + | warning() { | |
| 55 | + | echo -e "${YELLOW}[WARN]${NC} $1" | |
| 56 | + | } | |
| 57 | + | ||
| 21 | 58 | error() { | |
| 22 | 59 | echo -e "${RED}[ERROR]${NC} $1" | |
| 23 | 60 | exit 1 | |
| @@ -48,19 +85,38 @@ REPO_OWNER="bnema" | |||
| 48 | 85 | REPO_NAME="archup" | |
| 49 | 86 | BINARY_NAME="archup-installer" | |
| 50 | 87 | ||
| 51 | - | # Download latest release | |
| 52 | - | info "Fetching latest release information..." | |
| 53 | - | LATEST_RELEASE_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" | |
| 54 | - | LATEST_TAG=$(curl -s "$LATEST_RELEASE_URL" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
| 88 | + | # Determine which version to download | |
| 89 | + | if [ -n "$SPECIFIC_VERSION" ]; then | |
| 90 | + | # User specified a version | |
| 91 | + | LATEST_TAG="$SPECIFIC_VERSION" | |
| 92 | + | info "Using specific version: $LATEST_TAG" | |
| 93 | + | elif [ "$DEV_MODE" = true ]; then | |
| 94 | + | # Get latest pre-release (including dev/rc builds) | |
| 95 | + | warning "Dev mode: fetching latest pre-release..." | |
| 96 | + | RELEASES_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases" | |
| 97 | + | LATEST_TAG=$(curl -s "$RELEASES_URL" | grep -m 1 '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
| 98 | + | ||
| 99 | + | if [ -z "$LATEST_TAG" ]; then | |
| 100 | + | error "Failed to fetch latest pre-release" | |
| 101 | + | fi | |
| 102 | + | warning "Latest pre-release: $LATEST_TAG" | |
| 103 | + | else | |
| 104 | + | # Get latest stable release | |
| 105 | + | info "Fetching latest stable release..." | |
| 106 | + | LATEST_RELEASE_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" | |
| 107 | + | LATEST_TAG=$(curl -s "$LATEST_RELEASE_URL" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
| 55 | 108 | ||
| 56 | - | if [ -z "$LATEST_TAG" ]; then | |
| 57 | - | error "Failed to fetch latest release tag" | |
| 109 | + | if [ -z "$LATEST_TAG" ]; then | |
| 110 | + | error "Failed to fetch latest release tag" | |
| 111 | + | fi | |
| 112 | + | success "Latest version: $LATEST_TAG" | |
| 58 | 113 | fi | |
| 59 | - | success "Latest version: $LATEST_TAG" | |
| 60 | 114 | ||
| 61 | 115 | # Download binary | |
| 62 | 116 | BINARY_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/$BINARY_NAME" | |
| 63 | 117 | BINARY_PATH="/tmp/$BINARY_NAME" | |
| 118 | + | CHECKSUM_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/checksums.txt" | |
| 119 | + | CHECKSUM_PATH="/tmp/checksums.txt" | |
| 64 | 120 | ||
| 65 | 121 | info "Downloading installer binary..." | |
| 66 | 122 | if ! curl -fsSL "$BINARY_URL" -o "$BINARY_PATH"; then | |
| @@ -68,6 +124,20 @@ if ! curl -fsSL "$BINARY_URL" -o "$BINARY_PATH"; then | |||
| 68 | 124 | fi | |
| 69 | 125 | success "Binary downloaded" | |
| 70 | 126 | ||
| 127 | + | # Download and verify checksum | |
| 128 | + | info "Downloading checksums..." | |
| 129 | + | if ! curl -fsSL "$CHECKSUM_URL" -o "$CHECKSUM_PATH"; then | |
| 130 | + | error "Failed to download checksums from $CHECKSUM_URL" | |
| 131 | + | fi | |
| 132 | + | success "Checksums downloaded" | |
| 133 | + | ||
| 134 | + | info "Verifying checksum..." | |
| 135 | + | cd /tmp | |
| 136 | + | if ! sha256sum -c "$CHECKSUM_PATH" --ignore-missing 2>/dev/null; then | |
| 137 | + | error "Checksum verification failed! Binary may be corrupted or tampered with." | |
| 138 | + | fi | |
| 139 | + | success "Checksum verified" | |
| 140 | + | ||
| 71 | 141 | # Make executable | |
| 72 | 142 | chmod +x "$BINARY_PATH" | |
| 73 | 143 | ||
| @@ -1,13 +1,46 @@ | |||||
| 1 | #!/bin/bash | 1 | #!/bin/bash | ||
| 2 | # ArchUp Installer Bootstrap Script | 2 | # ArchUp Installer Bootstrap Script | ||
| 3 | # Downloads and runs the ArchUp Go installer | 3 | # Downloads and runs the ArchUp Go installer | ||
| 4 | + | # | |||
| 5 | + | # Usage: | |||
| 6 | + | # curl -fsSL https://archup.run/install/bin | bash | |||
| 7 | + | # curl -fsSL https://archup.run/install/bin | bash -s -- --dev | |||
| 8 | + | # curl -fsSL https://archup.run/install/bin | bash -s -- --version v0.15.3-dev | |||
| 9 | + | # | |||
| 10 | + | # Or locally: | |||
| 11 | + | # ./install-bin.sh # Install latest stable release | |||
| 12 | + | # ./install-bin.sh --dev # Install latest pre-release (dev/rc builds) | |||
| 13 | + | # ./install-bin.sh --version v0.15.3-dev # Install specific version | |||
| 4 | 14 | ||||
| 5 | set -e | 15 | set -e | ||
| 6 | 16 | ||||
| 17 | + | # Parse arguments | |||
| 18 | + | DEV_MODE=false | |||
| 19 | + | SPECIFIC_VERSION="" | |||
| 20 | + | ||||
| 21 | + | while [[ $# -gt 0 ]]; do | |||
| 22 | + | case $1 in | |||
| 23 | + | --dev) | |||
| 24 | + | DEV_MODE=true | |||
| 25 | + | shift | |||
| 26 | + | ;; | |||
| 27 | + | --version) | |||
| 28 | + | SPECIFIC_VERSION="$2" | |||
| 29 | + | shift 2 | |||
| 30 | + | ;; | |||
| 31 | + | *) | |||
| 32 | + | echo "Unknown option: $1" | |||
| 33 | + | echo "Usage: $0 [--dev] [--version VERSION]" | |||
| 34 | + | exit 1 | |||
| 35 | + | ;; | |||
| 36 | + | esac | |||
| 37 | + | done | |||
| 38 | + | ||||
| 7 | # Colors for output | 39 | # Colors for output | ||
| 8 | RED='\033[0;31m' | 40 | RED='\033[0;31m' | ||
| 9 | GREEN='\033[0;32m' | 41 | GREEN='\033[0;32m' | ||
| 10 | BLUE='\033[0;34m' | 42 | BLUE='\033[0;34m' | ||
| 43 | + | YELLOW='\033[0;33m' | |||
| 11 | NC='\033[0m' # No Color | 44 | NC='\033[0m' # No Color | ||
| 12 | 45 | ||||
| 13 | info() { | 46 | info() { | ||
| @@ -18,6 +51,10 @@ success() { | |||||
| 18 | echo -e "${GREEN}[OK]${NC} $1" | 51 | echo -e "${GREEN}[OK]${NC} $1" | ||
| 19 | } | 52 | } | ||
| 20 | 53 | ||||
| 54 | + | warning() { | |||
| 55 | + | echo -e "${YELLOW}[WARN]${NC} $1" | |||
| 56 | + | } | |||
| 57 | + | ||||
| 21 | error() { | 58 | error() { | ||
| 22 | echo -e "${RED}[ERROR]${NC} $1" | 59 | echo -e "${RED}[ERROR]${NC} $1" | ||
| 23 | exit 1 | 60 | exit 1 | ||
| @@ -48,19 +85,38 @@ REPO_OWNER="bnema" | |||||
| 48 | REPO_NAME="archup" | 85 | REPO_NAME="archup" | ||
| 49 | BINARY_NAME="archup-installer" | 86 | BINARY_NAME="archup-installer" | ||
| 50 | 87 | ||||
| 51 | - | # Download latest release | 88 | + | # Determine which version to download |
| 52 | - | info "Fetching latest release information..." | 89 | + | if [ -n "$SPECIFIC_VERSION" ]; then |
| 53 | - | LATEST_RELEASE_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" | 90 | + | # User specified a version |
| 54 | - | LATEST_TAG=$(curl -s "$LATEST_RELEASE_URL" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | 91 | + | LATEST_TAG="$SPECIFIC_VERSION" |
| 92 | + | info "Using specific version: $LATEST_TAG" | |||
| 93 | + | elif [ "$DEV_MODE" = true ]; then | |||
| 94 | + | # Get latest pre-release (including dev/rc builds) | |||
| 95 | + | warning "Dev mode: fetching latest pre-release..." | |||
| 96 | + | RELEASES_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases" | |||
| 97 | + | LATEST_TAG=$(curl -s "$RELEASES_URL" | grep -m 1 '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |||
| 98 | + | ||||
| 99 | + | if [ -z "$LATEST_TAG" ]; then | |||
| 100 | + | error "Failed to fetch latest pre-release" | |||
| 101 | + | fi | |||
| 102 | + | warning "Latest pre-release: $LATEST_TAG" | |||
| 103 | + | else | |||
| 104 | + | # Get latest stable release | |||
| 105 | + | info "Fetching latest stable release..." | |||
| 106 | + | LATEST_RELEASE_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" | |||
| 107 | + | LATEST_TAG=$(curl -s "$LATEST_RELEASE_URL" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |||
| 55 | 108 | ||||
| 56 | - | if [ -z "$LATEST_TAG" ]; then | 109 | + | if [ -z "$LATEST_TAG" ]; then |
| 57 | - | error "Failed to fetch latest release tag" | 110 | + | error "Failed to fetch latest release tag" |
| 111 | + | fi | |||
| 112 | + | success "Latest version: $LATEST_TAG" | |||
| 58 | fi | 113 | fi | ||
| 59 | - | success "Latest version: $LATEST_TAG" | |||
| 60 | 114 | ||||
| 61 | # Download binary | 115 | # Download binary | ||
| 62 | BINARY_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/$BINARY_NAME" | 116 | BINARY_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/$BINARY_NAME" | ||
| 63 | BINARY_PATH="/tmp/$BINARY_NAME" | 117 | BINARY_PATH="/tmp/$BINARY_NAME" | ||
| 118 | + | CHECKSUM_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/checksums.txt" | |||
| 119 | + | CHECKSUM_PATH="/tmp/checksums.txt" | |||
| 64 | 120 | ||||
| 65 | info "Downloading installer binary..." | 121 | info "Downloading installer binary..." | ||
| 66 | if ! curl -fsSL "$BINARY_URL" -o "$BINARY_PATH"; then | 122 | if ! curl -fsSL "$BINARY_URL" -o "$BINARY_PATH"; then | ||
| @@ -68,6 +124,20 @@ if ! curl -fsSL "$BINARY_URL" -o "$BINARY_PATH"; then | |||||
| 68 | fi | 124 | fi | ||
| 69 | success "Binary downloaded" | 125 | success "Binary downloaded" | ||
| 70 | 126 | ||||
| 127 | + | # Download and verify checksum | |||
| 128 | + | info "Downloading checksums..." | |||
| 129 | + | if ! curl -fsSL "$CHECKSUM_URL" -o "$CHECKSUM_PATH"; then | |||
| 130 | + | error "Failed to download checksums from $CHECKSUM_URL" | |||
| 131 | + | fi | |||
| 132 | + | success "Checksums downloaded" | |||
| 133 | + | ||||
| 134 | + | info "Verifying checksum..." | |||
| 135 | + | cd /tmp | |||
| 136 | + | if ! sha256sum -c "$CHECKSUM_PATH" --ignore-missing 2>/dev/null; then | |||
| 137 | + | error "Checksum verification failed! Binary may be corrupted or tampered with." | |||
| 138 | + | fi | |||
| 139 | + | success "Checksum verified" | |||
| 140 | + | ||||
| 71 | # Make executable | 141 | # Make executable | ||
| 72 | chmod +x "$BINARY_PATH" | 142 | chmod +x "$BINARY_PATH" | ||
| 73 | 143 | ||||