Skip to content

Commit 03e9697

Browse files
author
Mike Zorn
authored
fix: Attach the docker socket to the build container (#399)
This attaches the docker socket so that we can build docker images from the container that publishes releases. Previously, the push of docker images was failing.
1 parent 3fec1f4 commit 03e9697

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.github/actions/publish/action.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ inputs:
1111
description: 'Is this a dry run. If so no package will be published.'
1212
required: false
1313
default: 'true'
14+
snapshot:
15+
description: 'Create a snapshot release by passing --snapshot to goreleaser. See also `goreleaser release --help'
16+
default: 'false'
17+
skip:
18+
description: 'Set of steps for goreleaser to skip. See also `goreleaser --skip`'
1419
tag:
1520
description: 'Tag to upload artifacts to.'
1621
required: true
@@ -29,10 +34,6 @@ runs:
2934
uses: docker/setup-buildx-action@v3
3035
with:
3136
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/386
32-
- name: Login to Docker
33-
shell: bash
34-
run: echo $DOCKER_TOKEN | docker login --username $DOCKER_USERNAME --password-stdin
35-
3637
- name: Set up goreleaser
3738
# Note: that we're unable to use the normal goreleaser actions and have to use this docker image.
3839
# This is because the dev server piece of the CLI uses SQLite which requires CGO and cross compilation.
@@ -42,6 +43,7 @@ runs:
4243
CONTAINER_ID="$(
4344
docker run --detach \
4445
--volume "$PWD:$PWD" \
46+
--volume /var/run/docker.sock:/var/run/docker.sock \
4547
--entrypoint tail \
4648
ghcr.io/goreleaser/goreleaser-cross:latest \
4749
-f /dev/null
@@ -50,6 +52,7 @@ runs:
5052
docker exec --tty "$CONTAINER_ID" apt-get update
5153
docker exec --tty "$CONTAINER_ID" apt-get install --no-install-recommends -y -q crossbuild-essential-i386
5254
docker exec --tty "$CONTAINER_ID" git config --global --add safe.directory '*'
55+
docker exec --workdir "$PWD" --tty "$CONTAINER_ID" docker login --username $DOCKER_USERNAME --password $DOCKER_TOKEN
5356
echo "CONTAINER_ID=$CONTAINER_ID" >> "$GITHUB_ENV"
5457
5558
- name: Run Goreleaser
@@ -60,7 +63,11 @@ runs:
6063
--workdir "$PWD"
6164
--tty
6265
"$CONTAINER_ID"
63-
goreleaser release ${{ inputs.dry-run == 'true' && '--skip=publish' || '' }} --config .goreleaser.yaml
66+
goreleaser release
67+
${{ inputs.dry-run == 'true' && '--skip=publish' || '' }}
68+
${{ inputs.snapshot == 'true' && '--snapshot' || '' }}
69+
${{ inputs.skip == '' && '' || format('--skip={0}', inputs.skip) }}
70+
--config .goreleaser.yaml
6471
env:
6572
GITHUB_TOKEN: ${{ inputs.token }}
6673
HOMEBREW_DEPLOY_KEY: ${{ inputs.homebrew-gh-secret }}

0 commit comments

Comments
 (0)