Skip to content

Commit

Permalink
chore: Fix deploy and simplify goreleaser usage
Browse files Browse the repository at this point in the history
The deploy broke with “error=git is in a dirty state” because I had copied a step to create a temporary file .release-env (https://github.com/goreleaser/goreleaser-cross-example/blob/a5a2d67e191918dbe322589d66586f67e8a66914/.github/workflows/release.yaml#L21) but forgot to copy the corresponding .gitignore pattern. This commit takes out that file to simplify.
  • Loading branch information
Yonathan Randolph committed May 16, 2023
1 parent 0567e79 commit be1d8e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ jobs:
- name: Fetch all tags
# this is needed if you use TagBody, TagSubject or TagContents in your template
run: git fetch --force --tags
- name: setup release environment for make release
# copied from https://github.com/goreleaser/goreleaser-cross-example/blob/a5a2d67e191918dbe322589d66586f67e8a66914/.github/workflows/release.yaml#L21
run: |-
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env
- name: release publish
run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ cross-build:

# based on
# https://github.com/goreleaser/goreleaser-cross-example/blob/a5a2d67e191918dbe322589d66586f67e8a66914/Makefile#L15-L25
# but with --debug to diagnose CFLAGS problems
# This target calls back to make libgit2 from within docker
.PHONY: release-dry-run
release-dry-run:
Expand All @@ -50,17 +51,15 @@ release-dry-run:

# based on
# https://github.com/goreleaser/goreleaser-cross-example/blob/a5a2d67e191918dbe322589d66586f67e8a66914/Makefile#L27-L42
# but simplified without --env-file since we are not worried
# about leaking environment variables to other users of the machine.
# This target calls back to make libgit2 from within docker
.PHONY: release
release:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
-e CGO_ENABLED=1 \
--env-file .release-env \
--env=CGO_ENABLED=1 \
--env=GITHUB_TOKEN \
-v `pwd`:/go/src/${PACKAGE_NAME} \
-v `pwd`/sysroot:/sysroot \
-w /go/src/${PACKAGE_NAME} \
Expand Down

0 comments on commit be1d8e3

Please sign in to comment.