Repository: goreleaser/goreleaser
Pull request #2100 (2021-03-10 08:30:18)

chore(deps): bump codecov/codecov-action from v1.2.1 to v1.2.2
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.2.1 to v1.2.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/codecov/codecov-action/releases">codecov/codecov-action's releases</a>.</em></p>
<blockquote>
<h2>v1.2.2</h2>
<h3>Fixes</h3>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/241">#241</a> pass root_dir using proper bash arg</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/244">#244</a> Overwrite the commit on pull_request* events</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md">codecov/codecov-action's changelog</a>.</em></p>
<blockquote>
<h3>1.2.2</h3>
<h4>Fixes</h4>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/241">#241</a> pass root_dir using proper bash arg</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/244">#244</a> Overwrite the commit on pull_request* events</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/codecov/codecov-action/commit/1f8f3abcccf7960749744fd13547965f0e7d1bdd"><code>1f8f3ab</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/247">#247</a> from codecov/1.2.2</li>
<li><a href="https://github.com/codecov/codecov-action/commit/763298c6f68b6b2d4191362e8da948ad180b4299"><code>763298c</code></a> Update CHANGELOG.md</li>
<li><a href="https://github.com/codecov/codecov-action/commit/3207ad4e6013c331c40ac815c772d6e9714f5f77"><code>3207ad4</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/241">#241</a> from jeffkenney/fix-root-dir-arg</li>
<li><a href="https://github.com/codecov/codecov-action/commit/ab3cfafc5bac7280958384264e1b954433cce9a7"><code>ab3cfaf</code></a> Bump to 1.2.2</li>
<li><a href="https://github.com/codecov/codecov-action/commit/b708b7e81f3f8e04728cc8e1b1ad83735f01101f"><code>b708b7e</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/244">#244</a> from codecov/override-fetch-depth</li>
<li><a href="https://github.com/codecov/codecov-action/commit/65f43cece2c52d3e87256602f328dc0cdd5ef4df"><code>65f43ce</code></a> actually</li>
<li><a href="https://github.com/codecov/codecov-action/commit/21a1e2948d977d4477e71e5e0f60f5e99ee85d77"><code>21a1e29</code></a> Actually update tests</li>
<li><a href="https://github.com/codecov/codecov-action/commit/227f879cd03fed3c0d76aae788c9d15686a69ee7"><code>227f879</code></a> Fix test</li>
<li><a href="https://github.com/codecov/codecov-action/commit/87fff2e89192974683dff75f10ae2d2324ace888"><code>87fff2e</code></a> payload</li>
<li><a href="https://github.com/codecov/codecov-action/commit/50212c96c805bbdb40f17c5b2a36448c12b45ba2"><code>50212c9</code></a> Dont need event</li>
<li>Additional commits viewable in <a href="https://github.com/codecov/codecov-action/compare/v1.2.1...1f8f3abcccf7960749744fd13547965f0e7d1bdd">compare view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

vercel[bot]: This pull request is being automatically deployed with Vercel ([learn more](https://vercel.link/github-learn-more)).  
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: [https://vercel.com/goreleaser/goreleaser/9iWouR2kAV3y6cLfkEZV4gdVSkGJ](https://vercel.com/goreleaser/goreleaser/9iWouR2kAV3y6cLfkEZV4gdVSkGJ)  
✅ Preview: *In Progress*


codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2100?src=pr&el=h1) Report
> Merging [#2100](https://codecov.io/gh/goreleaser/goreleaser/pull/2100?src=pr&el=desc) (e4b7247) into [master](https://codecov.io/gh/goreleaser/goreleaser/commit/1e56af2476188070a1398e292f80406d582fbe4f?el=desc) (1e56af2) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/goreleaser/goreleaser/pull/2100/graphs/tree.svg?width=650&height=150&src=pr&token=3bJvv6b7hN)](https://codecov.io/gh/goreleaser/goreleaser/pull/2100?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #2100   +/-   ##
=======================================
  Coverage   82.68%   82.69%           
=======================================
  Files          74       74           
  Lines        4003     4004    +1     
=======================================
+ Hits         3310     3311    +1     
  Misses        565      565           
  Partials      128      128           
```


| [Impacted Files](https://codecov.io/gh/goreleaser/goreleaser/pull/2100?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [internal/pipe/nfpm/nfpm.go](https://codecov.io/gh/goreleaser/goreleaser/pull/2100/diff?src=pr&el=tree#diff-aW50ZXJuYWwvcGlwZS9uZnBtL25mcG0uZ28=) | `95.49% <100.00%> (+0.02%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2100?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2100?src=pr&el=footer). Last update [2d3ec15...e4b7247](https://codecov.io/gh/goreleaser/goreleaser/pull/2100?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 63c79f1c..133dab4e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -53,7 +53,7 @@ jobs:
           make ci
       -
         name: Upload coverage
-        uses: codecov/codecov-action@v1.2.1
+        uses: codecov/codecov-action@v1.2.2
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           file: ./coverage.txt
diff --git a/internal/pipe/snapcraft/snapcraft.go b/internal/pipe/snapcraft/snapcraft.go
index 4b0b82bc..f849fda4 100644
--- a/internal/pipe/snapcraft/snapcraft.go
+++ b/internal/pipe/snapcraft/snapcraft.go
@@ -43,6 +43,7 @@ type Metadata struct {
 	Grade         string `yaml:",omitempty"`
 	Confinement   string `yaml:",omitempty"`
 	Architectures []string
+	Layout        map[string]LayoutMetadata `yaml:",omitempty"`
 	Apps          map[string]AppMetadata
 	Plugs         map[string]interface{} `yaml:",omitempty"`
 }
@@ -56,6 +57,13 @@ type AppMetadata struct {
 	RestartCondition string   `yaml:"restart-condition,omitempty"`
 }
 
+type LayoutMetadata struct {
+	Symlink  string `yaml:",omitempty"`
+	Bind     string `yaml:",omitempty"`
+	BindFile string `yaml:"bind-file,omitempty"`
+	Type     string `yaml:",omitempty"`
+}
+
 const defaultNameTemplate = "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
 
 // Pipe for snapcraft packaging.
@@ -199,6 +207,7 @@ func create(ctx *context.Context, snap config.Snapcraft, arch string, binaries [
 		Grade:         snap.Grade,
 		Confinement:   snap.Confinement,
 		Architectures: []string{arch},
+		Layout:        map[string]LayoutMetadata{},
 		Apps:          map[string]AppMetadata{},
 	}
 
@@ -215,6 +224,15 @@ func create(ctx *context.Context, snap config.Snapcraft, arch string, binaries [
 		metadata.Name = snap.Name
 	}
 
+	for targetPath, layout := range snap.Layout {
+		metadata.Layout[targetPath] = LayoutMetadata{
+			Symlink:  layout.Symlink,
+			Bind:     layout.Bind,
+			BindFile: layout.BindFile,
+			Type:     layout.Type,
+		}
+	}
+
 	// if the user didn't specify any apps then
 	// default to the main binary being the command:
 	if len(snap.Apps) == 0 {
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 1f2c18ef..634e079f 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -439,23 +439,31 @@ type SnapcraftAppMetadata struct {
 	RestartCondition string `yaml:"restart_condition,omitempty"`
 }
 
+type SnapcraftLayoutMetadata struct {
+	Symlink  string `yaml:",omitempty"`
+	Bind     string `yaml:",omitempty"`
+	BindFile string `yaml:"bind_file,omitempty"`
+	Type     string `yaml:",omitempty"`
+}
+
 // Snapcraft config.
 type Snapcraft struct {
 	NameTemplate string            `yaml:"name_template,omitempty"`
 	Replacements map[string]string `yaml:",omitempty"`
 	Publish      bool              `yaml:",omitempty"`
 
-	ID          string                          `yaml:",omitempty"`
-	Builds      []string                        `yaml:",omitempty"`
-	Name        string                          `yaml:",omitempty"`
-	Summary     string                          `yaml:",omitempty"`
-	Description string                          `yaml:",omitempty"`
-	Base        string                          `yaml:",omitempty"`
-	License     string                          `yaml:",omitempty"`
-	Grade       string                          `yaml:",omitempty"`
-	Confinement string                          `yaml:",omitempty"`
-	Apps        map[string]SnapcraftAppMetadata `yaml:",omitempty"`
-	Plugs       map[string]interface{}          `yaml:",omitempty"`
+	ID          string                             `yaml:",omitempty"`
+	Builds      []string                           `yaml:",omitempty"`
+	Name        string                             `yaml:",omitempty"`
+	Summary     string                             `yaml:",omitempty"`
+	Description string                             `yaml:",omitempty"`
+	Base        string                             `yaml:",omitempty"`
+	License     string                             `yaml:",omitempty"`
+	Grade       string                             `yaml:",omitempty"`
+	Confinement string                             `yaml:",omitempty"`
+	Layout      map[string]SnapcraftLayoutMetadata `yaml:",omitempty"`
+	Apps        map[string]SnapcraftAppMetadata    `yaml:",omitempty"`
+	Plugs       map[string]interface{}             `yaml:",omitempty"`
 
 	Files []SnapcraftExtraFiles `yaml:"extra_files,omitempty"`
 }
diff --git a/www/docs/customization/scoop.md b/www/docs/customization/scoop.md
index a590ede6..c772205c 100644
--- a/www/docs/customization/scoop.md
+++ b/www/docs/customization/scoop.md
@@ -45,6 +45,13 @@ scoop:
   # Default is empty.
   license: MIT
 
+  # Setting this will prevent goreleaser to actually try to commit the updated
+  # manifest leaving the responsibility of publishing it to the user.
+  # If set to auto, the release will not be uploaded to the scoop bucket
+  # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
+  # Default is false.
+  skip_upload: true
+
   # Persist data between application updates
   persist:
   - "data"
diff --git a/www/docs/customization/snapcraft.md b/www/docs/customization/snapcraft.md
index 341f0f73..363c95f0 100644
--- a/www/docs/customization/snapcraft.md
+++ b/www/docs/customization/snapcraft.md
@@ -98,6 +98,39 @@ snapcrafts:
         destination: bin/drumroll.wrapper
         mode: 0755
 
+    # With layouts, you can make elements in $SNAP, $SNAP_DATA, $SNAP_COMMON
+    # accessible from locations such as /usr, /var and /etc. This helps when using
+    # pre-compiled binaries and libraries that expect to find files and
+    # directories outside of locations referenced by $SNAP or $SNAP_DATA.
+    # About snap environment variables:
+    # * HOME: set to SNAP_USER_DATA for all commands
+    # * SNAP: read-only install directory
+    # * SNAP_ARCH: the architecture of device (eg, amd64, arm64, armhf, i386, etc)
+    # * SNAP_DATA: writable area for a particular revision of the snap
+    # * SNAP_COMMON: writable area common across all revisions of the snap
+    # * SNAP_LIBRARY_PATH: additional directories which should be added to LD_LIBRARY_PATH
+    # * SNAP_NAME: snap name
+    # * SNAP_INSTANCE_NAME: snap instance name incl. instance key if one is set (snapd 2.36+)
+    # * SNAP_INSTANCE_KEY: instance key if any (snapd 2.36+)
+    # * SNAP_REVISION: store revision of the snap
+    # * SNAP_USER_DATA: per-user writable area for a particular revision of the snap
+    # * SNAP_USER_COMMON: per-user writable area common across all revisions of the snap
+    # * SNAP_VERSION: snap version (from snap.yaml)
+    # More info about layout here:
+    # https://snapcraft.io/docs/snap-layouts
+    # Default is empty.
+    layout:
+      # The path you want to access in sandbox.
+      /etc/drumroll:
+
+        # Which outside file or directory you want to map to sandbox.
+        # Valid keys are:
+        # * bind - Bind-mount a directory.
+        # * bind_file - Bind-mount a file.
+        # * symlink - Create a symbolic link.
+        # * type - Mount a private temporary in-memory filesystem.
+        bind: $SNAP_DATA/etc
+
     # Each binary built by GoReleaser is an app inside the snap. In this section
     # you can declare extra details for those binaries. It is optional.
     apps:


Test patch:
diff --git a/internal/pipe/snapcraft/snapcraft_test.go b/internal/pipe/snapcraft/snapcraft_test.go
index d0388a80..5cb96868 100644
--- a/internal/pipe/snapcraft/snapcraft_test.go
+++ b/internal/pipe/snapcraft/snapcraft_test.go
@@ -153,6 +153,9 @@ func TestRunPipeMetadata(t *testing.T) {
 				NameTemplate: "foo_{{.Arch}}",
 				Summary:      "test summary",
 				Description:  "test description",
+				Layout: map[string]config.SnapcraftLayoutMetadata{
+					"/etc/testprojectname": {Bind: "$SNAP_DATA/etc"},
+				},
 				Apps: map[string]config.SnapcraftAppMetadata{
 					"foo": {
 						Plugs:            []string{"home", "network", "personal-files"},
@@ -187,6 +190,7 @@ func TestRunPipeMetadata(t *testing.T) {
 	require.Equal(t, "foo --foo --bar", metadata.Apps["foo"].Command)
 	require.Equal(t, map[interface{}]interface{}{"read": []interface{}{"$HOME/test"}}, metadata.Plugs["personal-files"])
 	require.Equal(t, "always", metadata.Apps["foo"].RestartCondition)
+	require.Equal(t, "$SNAP_DATA/etc", metadata.Layout["/etc/testprojectname"].Bind)
 }
 
 func TestNoSnapcraftInPath(t *testing.T) {