Skip to content

Commit

Permalink
docs: update github-action documentation (#3640)
Browse files Browse the repository at this point in the history
Using the new version (v4) everywhere.

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Dec 14, 2022
1 parent 9370676 commit 3cfe215
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
6 changes: 3 additions & 3 deletions www/docs/ci/actions.md
Expand Up @@ -40,7 +40,7 @@ jobs:
cache: true
# More assembly might be required: Docker logins, GPG, etc. It all depends
# on your needs.
- uses: goreleaser/goreleaser-action@v2
- uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
Expand Down Expand Up @@ -94,7 +94,7 @@ the [Import GPG][import-gpg] GitHub Action along with this one:
passphrase: ${{ secrets.PASSPHRASE }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
Expand Down Expand Up @@ -176,7 +176,7 @@ step will look like this:
```yaml
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
Expand Down
27 changes: 21 additions & 6 deletions www/docs/cookbooks/override-image-name.md
@@ -1,10 +1,23 @@
# Override hardcoded registry and image name ?

If you are curious about how to avoid hard-coded registry and image names within your `.goreleaser.yml`, we have good news for you. Here is the solution. Suppose you haven't been aware of GoReleaser Action, which allows you to install GoReleaser binary in your workflow easily. In that case, this is the right time to be mindful of that because, in this section, we'll give an example through GoReleaser's GitHub Action.
If you are curious about how to avoid hard-coded registry and image names within
your `.goreleaser.yml`, we have good news for you. Here is the solution. Suppose
you haven't been aware of GoReleaser Action, which allows you to install
GoReleaser binary in your workflow easily. In that case, this is the right time
to be mindful of that because, in this section, we'll give an example through
GoReleaser's GitHub Action.

> To get more detail about the GoReleaser's GitHub Action, please [see](https://github.com/goreleaser/goreleaser-action).
> To get more detail about the GoReleaser's GitHub Action, please
> [see](https://github.com/goreleaser/goreleaser-action).
As you can see from the description [here](https://github.com/goreleaser/goreleaser-action#environment-variables), you can pass environment variables to the GoReleaser to use within the `.goreleaser.yml` via syntax `{{ .Env.<something> }}`. So, let' define our registry and image names as an [environment variable in the workflow](https://docs.github.com/en/actions/learn-github-actions/environment-variables), then pass those to the GoReleaser via `env` section of the GoReleaser's GitHub Action like the following:
As you can see from the description
[here](https://github.com/goreleaser/goreleaser-action#environment-variables),
you can pass environment variables to the GoReleaser to use within the
`.goreleaser.yml` via syntax `{{ .Env.<something> }}`. So, let' define our
registry and image names as an [environment variable in the
workflow](https://docs.github.com/en/actions/learn-github-actions/environment-variables),
then pass those to the GoReleaser via `env` section of the GoReleaser's GitHub
Action like the following:

```YAML
jobs:
Expand All @@ -16,7 +29,7 @@ As you can see from the description [here](https://github.com/goreleaser/gorelea
IMAGE_NAME: "google/addlicense"
...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
Expand All @@ -27,7 +40,8 @@ As you can see from the description [here](https://github.com/goreleaser/gorelea
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

Once you pass those to the GoReleaser, you can access them within your `.goreleaser.yml` file as I mentioned above, here is the example of this:
Once you pass those to the GoReleaser, you can access them within your
`.goreleaser.yml` file as I mentioned above, here is the example of this:

```YAML
dockers:
Expand All @@ -45,4 +59,5 @@ dockers:
- "--platform=linux/amd64"
```

That's all we need to do, you even might be surprised when you notice that how easy it is to overcome this issue.
That's all we need to do, you even might be surprised when you notice that how
easy it is to overcome this issue.
10 changes: 6 additions & 4 deletions www/docs/errors/resource-not-accessible-by-integration.md
@@ -1,8 +1,10 @@
# Resource not accessible by integration

When using GitHub Actions, you might feel tempted to use the action-bound `GITHUB_TOKEN`.
When using GitHub Actions, you might feel tempted to use the action-bound
`GITHUB_TOKEN`.

While it is a good practice, and should work for most cases, if your workflow writes a file in another repository, you may see this error:
While it is a good practice, and should work for most cases, if your workflow
writes a file in another repository, you may see this error:

```sh
⨯ release failed after 430.85s error=homebrew tap formula: failed to publish artifacts: PUT https://api.github.com/repos/user/homebrew-tap/contents/Formula/scorecard.rb: 403 Resource not accessible by integration []
Expand All @@ -25,7 +27,7 @@ You'll need to add it as secret and pass it to the action, for instance:
```yaml
# .github/workflows/goreleaser.yaml
# ...
- uses: goreleaser/goreleaser-action@v2
- uses: goreleaser/goreleaser-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
# ...
Expand All @@ -42,7 +44,7 @@ We would need to change the workflow file:
```yaml
# .github/workflows/goreleaser.yaml
# ...
- uses: goreleaser/goreleaser-action@v2
- uses: goreleaser/goreleaser-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
Expand Down

0 comments on commit 3cfe215

Please sign in to comment.