mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
docs: update github-action documentation (#3640)
Using the new version (v4) everywhere. Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
937067697b
commit
3cfe215d4c
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
|
@ -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:
|
||||
@ -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
|
||||
@ -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:
|
||||
@ -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.
|
||||
|
@ -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 []
|
||||
@ -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 }}
|
||||
# ...
|
||||
@ -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 }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user