Skip to content

CICD: GoReleaser generates TypeScript file#2704

Merged
tlimoncelli merged 3 commits intoStackExchange:masterfrom
cafferata:cicd/goreleaser-before-hooks
Dec 10, 2023
Merged

CICD: GoReleaser generates TypeScript file#2704
tlimoncelli merged 3 commits intoStackExchange:masterfrom
cafferata:cicd/goreleaser-before-hooks

Conversation

@cafferata
Copy link
Copy Markdown
Collaborator

@cafferata cafferata commented Dec 10, 2023

Closes #2692

Introduction

The first iteration of GoReleaser refactor where the TypeScript file (types-dnscontrol.d.ts) no longer needs to be generated manually, neither hardcoded is included in the source code. 🚀

How have these activities been tested?

Set up local setup
  1. Install GoReleaser

    brew install goreleaser

    https://goreleaser.com/install/#homebrew

  1. GoReleaser configuration checked
    goreleaser check .goreleaser.yml
      • checking                                 path=.goreleaser.yml
      • 1 configuration file(s) validated
      • thanks for using goreleaser!
    
  2. Started the GoReleaser build from the local machine.
    goreleaser build --snapshot --clean
      • starting build...
      • loading                                          path=.goreleaser.yml
      • skipping validate...
      • loading environment variables
      • getting and validating git state
        • git state                                      commit=5ad9d2baa128016fa070be71f221008f012e3dea branch=cicd/goreleaser-before-hooks current_tag=v4.7.2 previous_tag=v4.6.3 dirty=false
        • pipe skipped                                   reason=disabled during snapshot mode
      • parsing tag
      • setting defaults
      • snapshotting
        • building snapshot...                           version=4.7.3-next
      • running before hooks
        • running                                        hook=go fmt ./...
        • running                                        hook=go mod tidy
        • running                                        hook=go generate ./...
        • took: 2s
      • checking distribution directory
        • cleaning dist
      • loading go mod information
      • build prerequisites
      • writing effective config file
        • writing                                        config=dist/config.yaml
      • building binaries
        • building                                       binary=dist/build_darwin_arm64/dnscontrol
        • building                                       binary=dist/build_darwin_amd64_v1/dnscontrol
        • took: 3s
      • universal binaries
        • creating from 2 binaries                       id=build binary=dist/build_darwin_all/dnscontrol
      • storing release metadata
        • writing                                        file=dist/artifacts.json
        • writing                                        file=dist/metadata.json
      • build succeeded after 5s
      • thanks for using goreleaser!
    
  3. Review the generated binary
    dist/build_darwin_all/dnscontrol version
    dnscontrol "4.7.3-next" ("5ad9d2baa128016fa070be71f221008f012e3dea") built 10 Dec 23 08:15 CET
    
  4. Generate the TypeScript file.
    dist/build_darwin_all/dnscontrol write-types
    Successfully wrote types-dnscontrol.d.ts
    
  5. Check the generated TypeScript file.
    grep "^//" types-dnscontrol.d.ts
    // This file was automatically generated by DNSControl. Do not edit it directly.
    // To update it, run `dnscontrol write-types`.
    // DNSControl version: "4.7.3-next" ("5ad9d2baa128016fa070be71f221008f012e3dea") built 10 Dec 23 08:15 CET
    // WARNING: These type definitions are experimental and subject to change in future releases.
    // Cloudflare aliases:
    

cc: @j-f1 for visibility of the TypeScript generation.

@tlimoncelli tlimoncelli merged commit 8f1b33a into StackExchange:master Dec 10, 2023
tlimoncelli added a commit that referenced this pull request Dec 10, 2023
@cafferata cafferata deleted the cicd/goreleaser-before-hooks branch December 10, 2023 15:39
@tlimoncelli
Copy link
Copy Markdown
Contributor

@cafferata
Copy link
Copy Markdown
Collaborator Author

Interesting! Because I have not seen this output before. I check it from the master branch.

@cafferata
Copy link
Copy Markdown
Collaborator Author

Ah! It's not the GoReleaser build. It's go install for unit tests.

Reproducible case

rm -rf commands/types/dnscontrol.d.ts
go install
commands/writeTypes.go:40:12: pattern types/dnscontrol.d.ts: no matching files found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GoReleaser - hooks feature

2 participants