github.com/fitzix/goreleaser@v0.92.0/www/content/quick-start.md (about)

     1  ---
     2  title: Quick Start
     3  weight: 10
     4  menu: true
     5  ---
     6  
     7  In this example we will build, archive and release a Go project.
     8  
     9  Create a GitHub repository and add a single main package:
    10  
    11  ```go
    12  // main.go
    13  package main
    14  
    15  func main() {
    16    println("Ba dum, tss!")
    17  }
    18  ```
    19  
    20  Run `goreleaser init` to create an example `.goreleaser.yaml` file:
    21  
    22  ```console
    23  $ goreleaser init
    24  
    25     • Generating .goreleaser.yml file
    26     • config created; please edit accordingly to your needs file=.goreleaser.yml
    27  ```
    28  
    29  The generated config file will look like this:
    30  
    31  ```yml
    32  # This is an example goreleaser.yaml file with some sane defaults.
    33  # Make sure to check the documentation at http://goreleaser.com
    34  builds:
    35  - env:
    36    - CGO_ENABLED=0
    37  archive:
    38    replacements:
    39      darwin: Darwin
    40      linux: Linux
    41      windows: Windows
    42      386: i386
    43      amd64: x86_64
    44  checksum:
    45    name_template: 'checksums.txt'
    46  snapshot:
    47    name_template: "{{ .Tag }}-next"
    48  changelog:
    49    sort: asc
    50    filters:
    51      exclude:
    52      - '^docs:'
    53      - '^test:'
    54  ```
    55  
    56  GoReleaser will build the binaries for your app for Windows, Linux and macOS,
    57  both amd64 and i386 architectures. You can customize that by changing the
    58  `builds` section. Check the [documentation](/build) for more information.
    59  
    60  After building the binaries, GoReleaser will create an archive for each OS/Arch
    61  pair into a separate file. You can customize several things by changing
    62  the `archive` section. Check the [documentation](/archive) for more information.
    63  
    64  You'll need to export a `GITHUB_TOKEN` environment variable, which should
    65  contain a valid GitHub token with the `repo` scope.
    66  It will be used to deploy releases to your GitHub repository.
    67  You can create a token [here](https://github.com/settings/tokens/new).
    68  
    69  ```console
    70  $ export GITHUB_TOKEN=`YOUR_TOKEN`
    71  ```
    72  
    73  GoReleaser will use the latest
    74  [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) of your repository.
    75  Create a tag and push it to GitHub:
    76  
    77  ```console
    78  $ git tag -a v0.1.0 -m "First release"
    79  $ git push origin v0.1.0
    80  ```
    81  
    82  > **Attention**: Check if your tag adheres to [semantic versioning](/semver).
    83  
    84  If you don't want to create a tag yet, you can also create a release
    85  based on the latest commit by using the `--snapshot` flag.
    86  
    87  Now you can run GoReleaser at the root of your repository:
    88  
    89  ```console
    90  $ goreleaser
    91  ```
    92  
    93  That's all! Check your GitHub project's release page.
    94  The release should look like this:
    95  
    96  <a href="https://github.com/goreleaser/goreleaser/releases">
    97    <img width="100%"
    98      src="https://cloud.githubusercontent.com/assets/245435/23342061/fbcbd506-fc31-11e6-9d2b-4c1b776dee9c.png">
    99  </a>
   100  
   101  ## Dry run
   102  
   103  If you want to test everything before doing a release "for real", you can
   104  use the `--skip-publish` flag, which will only build and package things:
   105  
   106  ```console
   107  $ goreleaser release --skip-publish
   108  ```
   109  
   110  You can check the other options by running:
   111  
   112  ```console
   113  $ goreleaser --help
   114  ```
   115  
   116  and
   117  
   118  ```console
   119  $ goreleaser release --help
   120  ```