Closed arbourd closed 1 year ago
Oh, I didn't know that was even in there! No, the pwd
should be fine and it's a better/safer solution than what I suggested. The wildcard would match everything.
It might still be broken in actions because the global config doesn't seem to exist properly. Let me test with the latest v1.20.0
-- I was using v1.19.4
earlier.
try image from ghcr.io
Appears to be unresolved:
⨯ release failed after 0s error=current folder is not a git repository
The error "not a git repository" is due to the rev-parse
command failing, due to an unsafe/dubious folder.
I will build and try --system
over --global
and see if that resolves it tomorrow/Monday.
i think the best option would be to keep an extra run step instead of adding it goreleaser-cross and wait till checkout/action
makes a fix
For those who are facing the same issue, here is a fix:
jobs:
goreleaser:
runs-on: ubuntu-latest
container:
image: goreleaser/goreleaser-cross
environment: build
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
Hey guys! I have the same problem but cannot solve it with the workaround posted above. I am using docker to trigger go releaser cross compile:
docker run......ghcr.io/goreleaser/goreleaser-cross:1.20.1 -f .goreleaser.yml release --clean
The error is:
• starting release... • loading config file file=.goreleaser.yml • loading environment variables • using token from "$GITHUB_TOKEN" • getting and validating git state ⨯ release failed after 0s error=current folder is not a git repository
Any suggestions? Thank you
how do you mount workdir to docker?
how do you mount workdir to docker?
Hi troian, this is the full command:
docker run \ --rm \ --privileged \ --entrypoint ./goreleaser_entry.sh \ --env-file .release-env \ -v /var/run/docker.sock:/var/run/docker.sock \ -v
pwd:/go/src/$(PACKAGE_NAME) \ -w /go/src/$(PACKAGE_NAME) \ goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ -f .goreleaser.yml release --rm-dist
do you use custom entry point --entrypoint ./goreleaser_entry.sh
?
Due to a bug in actions/checkout, this action cannot be used as a container without an additional step:
This is not unique to
goreleaser-cross
and will affect all versions until actions/checkout is fixed.But, in the meantime, there is a method we can apply to the image that will allow it work without that extra step in the workflows. We could bake the command into the image itself with something like:
This would effectively disable the safe directory functionality within the goreleaser-cross container.