This repository was archived by the owner on Jul 27, 2025. It is now read-only.
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +34Lines changed: 34 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + packages: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - run: git fetch --force --tags |
| 24 | + |
| 25 | + - uses: actions/setup-go@v5 |
| 26 | + with: |
| 27 | + go-version: ">=1.23.2" |
| 28 | + |
| 29 | + - run: go mod download |
| 30 | + - uses: goreleaser/goreleaser-action@v6 |
| 31 | + with: |
| 32 | + distribution: goreleaser |
| 33 | + version: latest |
| 34 | + args: build --snapshot --clean |
Collapse file
Copy file name to clipboard +37Lines changed: 37 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - "*" |
| 8 | + |
| 9 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + packages: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + goreleaser: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - run: git fetch --force --tags |
| 24 | + |
| 25 | + - uses: actions/setup-go@v5 |
| 26 | + with: |
| 27 | + go-version: ">=1.23.2" |
| 28 | + |
| 29 | + - run: go mod download |
| 30 | + - uses: goreleaser/goreleaser-action@v6 |
| 31 | + with: |
| 32 | + distribution: goreleaser |
| 33 | + version: latest |
| 34 | + args: release --clean |
| 35 | + env: |
| 36 | + GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }} |
| 37 | + AUR_KEY: ${{ secrets.AUR_KEY }} |
Collapse file
Copy file name to clipboard +72Lines changed: 72 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +version: 2 |
| 2 | +project_name: opencode |
| 3 | +before: |
| 4 | + hooks: |
| 5 | +builds: |
| 6 | + - env: |
| 7 | + goos: |
| 8 | + - linux |
| 9 | + - darwin |
| 10 | + main: ./main.go |
| 11 | + |
| 12 | +archives: |
| 13 | + - format: tar.gz |
| 14 | + # this name template makes the OS and Arch compatible with the results of uname. |
| 15 | + name_template: >- |
| 16 | + opencode- |
| 17 | + {{- if eq .Os "darwin" }}mac- |
| 18 | + {{- else if eq .Os "windows" }}windows- |
| 19 | + {{- else if eq .Os "linux" }}linux-{{end}} |
| 20 | + {{- if eq .Arch "amd64" }}x86_64 |
| 21 | + {{- else if eq .Arch "#86" }}i386 |
| 22 | + {{- else }}{{ .Arch }}{{ end }} |
| 23 | + {{- if .Arm }}v{{ .Arm }}{{ end }} |
| 24 | + # use zip for windows archives |
| 25 | + format_overrides: |
| 26 | + - goos: windows |
| 27 | + format: zip |
| 28 | +checksum: |
| 29 | + name_template: "checksums.txt" |
| 30 | +snapshot: |
| 31 | + name_template: "0.0.0-{{ .Timestamp }}" |
| 32 | +aurs: |
| 33 | + - name: opencode |
| 34 | + homepage: "https://github.com/opencode-ai/opencode" |
| 35 | + description: "Deploy anything" |
| 36 | + maintainers: |
| 37 | + |
| 38 | + license: "MIT" |
| 39 | + private_key: "{{ .Env.AUR_KEY }}" |
| 40 | + |
| 41 | + provides: |
| 42 | + - opencode |
| 43 | + conflicts: |
| 44 | + - opencode |
| 45 | + package: |- |
| 46 | + install -Dm755 ./opencode "${pkgdir}/usr/bin/opencode" |
| 47 | +brews: |
| 48 | + - repository: |
| 49 | + owner: opencode-ai |
| 50 | + name: homebrew-tap |
| 51 | +nfpms: |
| 52 | + - maintainer: opencode |
| 53 | + description: terminal based agent that can build anything |
| 54 | + formats: |
| 55 | + - deb |
| 56 | + - rpm |
| 57 | + file_name_template: >- |
| 58 | + {{ .ProjectName }}- |
| 59 | + {{- if eq .Os "darwin" }}mac |
| 60 | + {{- else }}{{ .Os }}{{ end }}-{{ .Arch }} |
| 61 | +
|
| 62 | +changelog: |
| 63 | + sort: asc |
| 64 | + filters: |
| 65 | + exclude: |
| 66 | + - "^docs:" |
| 67 | + - "^doc:" |
| 68 | + - "^test:" |
| 69 | + - "^ci:" |
| 70 | + - "^ignore:" |
| 71 | + - "^example:" |
| 72 | + - "^wip:" |
Collapse file
Copy file name to clipboard +43Lines changed: 43 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Parse command line arguments |
| 4 | +minor=false |
| 5 | +while [ "$#" -gt 0 ]; do |
| 6 | + case "$1" in |
| 7 | + --minor) minor=true; shift 1;; |
| 8 | + *) echo "Unknown parameter: $1"; exit 1;; |
| 9 | + esac |
| 10 | +done |
| 11 | + |
| 12 | +git fetch --force --tags |
| 13 | + |
| 14 | +# Get the latest Git tag |
| 15 | +latest_tag=$(git tag --sort=committerdate | grep -E '[0-9]' | tail -1) |
| 16 | + |
| 17 | +# If there is no tag, exit the script |
| 18 | +if [ -z "$latest_tag" ]; then |
| 19 | + echo "No tags found" |
| 20 | + exit 1 |
| 21 | +fi |
| 22 | + |
| 23 | +echo "Latest tag: $latest_tag" |
| 24 | + |
| 25 | +# Split the tag into major, minor, and patch numbers |
| 26 | +IFS='.' read -ra VERSION <<< "$latest_tag" |
| 27 | + |
| 28 | +if [ "$minor" = true ]; then |
| 29 | + # Increment the minor version and reset patch to 0 |
| 30 | + minor_number=${VERSION[1]} |
| 31 | + let "minor_number++" |
| 32 | + new_version="${VERSION[0]}.$minor_number.0" |
| 33 | +else |
| 34 | + # Increment the patch version |
| 35 | + patch_number=${VERSION[2]} |
| 36 | + let "patch_number++" |
| 37 | + new_version="${VERSION[0]}.${VERSION[1]}.$patch_number" |
| 38 | +fi |
| 39 | + |
| 40 | +echo "New version: $new_version" |
| 41 | + |
| 42 | +git tag $new_version |
| 43 | +git push --tags |
Collapse file
Copy file name to clipboard +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -e |
| 3 | +goreleaser build --clean --snapshot --skip validate |