diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 1b51b629..376ecb67 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -22,18 +22,19 @@ jobs: with: go-version: ">=1.23" cache: true + - run: echo "${HOME}/.humanlog/bin" >> $GITHUB_PATH + - run: curl https://humanlog.dev/install_apictl.sh | bash - uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: latest - args: release --clean --draft --snapshot --config .goreleaser-dev.yaml + args: release --clean --draft --skip validate --config .goreleaser-dev.yaml env: GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} - - run: echo "${HOME}/.humanlog/bin" >> $GITHUB_PATH - - run: curl https://humanlog.dev/install_apictl.sh | bash - run: ./script/create_version_artifacts.sh env: CHANNEL: "dev" GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + API_URL: "https://api.humanlog.dev" HMAC_KEY_ID: ${{ secrets.DEV_HMAC_KEY_ID }} HMAC_PRIVATE_KEY: ${{ secrets.DEV_HMAC_PRIVATE_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47c52901..78ea41e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ name: Create a release on: + workflow_dispatch: push: tags: - "*" @@ -34,5 +35,6 @@ jobs: env: CHANNEL: "main" GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + API_URL: "https://api.humanlog.io" HMAC_KEY_ID: ${{ secrets.PROD_HMAC_KEY_ID }} HMAC_PRIVATE_KEY: ${{ secrets.PROD_HMAC_PRIVATE_KEY }} diff --git a/.goreleaser-dev.yaml b/.goreleaser-dev.yaml index d65589ea..299ad347 100644 --- a/.goreleaser-dev.yaml +++ b/.goreleaser-dev.yaml @@ -24,8 +24,16 @@ release: name: humanlog target_commitish: "{{ .Commit }}" prerelease: true + draft: true + replace_existing_draft: true + replace_existing_artifacts: true + name_template: "{{ incpatch .Version }}-next.{{ .Timestamp }}.{{ .ShortCommit }}" + header: | + ## very unstable dev build of humanlog ({{ .Date }}) + + Do not use. For folks iterating on humanlog and wanting to test their work. archives: - - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + - name_template: "{{ .ProjectName }}_{{ incpatch .Version }}-next.{{ .Timestamp }}.{{ .ShortCommit }}_{{ .Os }}_{{ .Arch }}" format_overrides: - goos: windows format: zip diff --git a/script/create_version_artifacts.sh b/script/create_version_artifacts.sh index fd66816b..e277223f 100755 --- a/script/create_version_artifacts.sh +++ b/script/create_version_artifacts.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -euo pipefail +set -euox pipefail root=$(git rev-parse --show-toplevel) @@ -12,9 +12,12 @@ function handle_archive() { while read -r filename; read -r path; read -r goos; read -r goarch; do local url=$(get_archive_url ${filename}) if [ -z "${url}" ]; then echo "no archive for ${filename}"; continue; fi - local sig=$(get_signature ${path}) - apictl create version-artifact \ +ls -lha $(dirname ${filename}) + + local sig=$(get_signature ${root}/${path}) + + apictl --api.url ${api_url} create version-artifact \ --project ${project} \ --major $(get_version_major) \ --minor $(get_version_minor) \ @@ -49,8 +52,9 @@ function get_sha256sum() { } function get_signature() { - local filename=${1} - cat ${filename}.sig + local filename=${1}.sig + if [ -f "${filename}" ]; then cat < ${filename}; + else echo "no-signature"; fi } function get_version_major() { @@ -83,13 +87,14 @@ function get_channel() { function main() { owner=humanlogio + api_url=${API_URL:-"https://api.humanlog.io"} project=$(get_project_name) tag=$(get_version) channel=$(get_channel) list_archives | handle_archive - apictl create published-version \ + apictl --api.url ${api_url} create published-version \ --project ${project} \ --channel ${channel} \ --version $(get_version)