fix: updating modification timestamps with GoReleaser#26
Merged
Conversation
The `metadata` section in GoReleaser allows you to attach **custom metadata** to your release artifacts. By adding information such as timestamps or commit hashes, you improve traceability and consistency for your software releases.
---
## Configuration Example
```yaml
metadata:
mod_timestamp: "{{ .CommitTimestamp }}"
```
This configuration updates the modification timestamp for all artifacts, aligning them with the commit that generated them.
---
## Key Benefits
1. **Traceability**
Including commit timestamps in metadata makes it easy to identify when a build was created. This is invaluable for debugging and pinpointing specific versions of your artifacts.
2. **Consistency**
Ensures that the metadata accurately reflects the project’s source code history, making it easier to correlate code changes with released artifacts.
---
## Configuration Option: `mod_timestamp`
The `mod_timestamp` option specifies the modification timestamp for your artifacts.
- **Template Variable**:
`{{ .CommitTimestamp }}`
This variable dynamically replaces the `mod_timestamp` with the actual timestamp of the commit, ensuring the artifacts are tightly linked to their source history.
---
# Quoting the GoReleaser documentation:
- https://goreleaser.com/customization/release/
## Metadata
GoReleaser creates some metadata files in the `dist` directory before it
finishes running.
You can also set some global defaults that can be used by other features.
```yaml title=".goreleaser.yaml"
metadata:
# Set the modified timestamp on the metadata files.
#
# Templates: allowed.
mod_timestamp: "{{ .CommitTimestamp }}"
# The maintainers of this software.
# Most features will only use the first maintainer defined here.
#
# <!-- md:inline_pro -->.
# <!-- md:inline_version v2.1 -->.
# Templates: allowed.
maintainers:
- "Foo Bar <foo at bar dot com>"
# SPDX identifier of your app's license.
#
# <!-- md:inline_pro -->.
# <!-- md:inline_version v2.1 -->.
# Templates: allowed.
license: "MIT"
# Your homepage.
#
# <!-- md:inline_pro -->.
# <!-- md:inline_version v2.1 -->.
# Templates: allowed.
homepage: "https://example.com/"
# Your app's description.
# Sometimes also referred as "short description".
#
# <!-- md:inline_pro -->.
# <!-- md:inline_version v2.1 -->.
# Templates: allowed.
description: "Software to create fast and easy drum rolls."
# Your app's full description, sometimes also referred to as "long description".
#
# It can be a string directly, or you can use `from_url` or `from_file` to
# source it from somewhere else.
#
# <!-- md:inline_pro -->.
# <!-- md:inline_version v2.1 -->.
# Templates: allowed.
full_description:
# Loads from an URL.
from_url:
# Templates: allowed.
url: https://foo.bar/README.md
headers:
x-api-token: "${MYCOMPANY_TOKEN}"
# Loads from a local file.
# Overrides `from_url`.
from_file:
# Templates: allowed.
path: ./README.md
```
<!-- md:templates -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
metadatasection in GoReleaser allows you to attach custom metadata to your release artifacts. By adding information such as timestamps or commit hashes, you improve traceability and consistency for your software releases.Configuration Example
This configuration updates the modification timestamp for all artifacts, aligning them with the commit that generated them.
Key Benefits
Traceability
Including commit timestamps in metadata makes it easy to identify when a build was created. This is invaluable for debugging and pinpointing specific versions of your artifacts.
Consistency
Ensures that the metadata accurately reflects the project’s source code history, making it easier to correlate code changes with released artifacts.
Configuration Option:
mod_timestampThe
mod_timestampoption specifies the modification timestamp for your artifacts.{{ .CommitTimestamp }}This variable dynamically replaces the
mod_timestampwith the actual timestamp of the commit, ensuring the artifacts are tightly linked to their source history.Quoting the GoReleaser documentation:
Metadata
GoReleaser creates some metadata files in the
distdirectory before itfinishes running.
You can also set some global defaults that can be used by other features.