Skip to content

Commit 6a16dfc

Browse files
committed
Reapply "fix: Reintroduce docker build action"
This reverts commit b52e07a.
1 parent c1213c3 commit 6a16dfc

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

.github/workflows/build-release-binaries.yml

+52-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
release:
55
types: [created]
66

7+
env:
8+
DOCKER_IMAGE_NAME: unstoppableswap/asb
9+
710
jobs:
811
build_binaries:
912
name: Build
@@ -82,7 +85,7 @@ jobs:
8285
run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help
8386

8487
- id: create-archive-name
85-
shell: python # Use python to have a prettier name for the archive on Windows.
88+
shell: python
8689
run: |
8790
import platform
8891
os_info = platform.uname()
@@ -122,3 +125,51 @@ jobs:
122125
asset_path: ./${{ steps.create-archive-name.outputs.archive }}
123126
asset_name: ${{ steps.create-archive-name.outputs.archive }}
124127
asset_content_type: application/gzip
128+
129+
build_and_push_docker:
130+
name: Build and Push Docker Image
131+
runs-on: ubuntu-latest
132+
needs: build_binaries
133+
steps:
134+
- name: Checkout code
135+
uses: actions/[email protected]
136+
with:
137+
ref: ${{ github.event.release.target_commitish }}
138+
139+
- name: Set up Docker Buildx
140+
uses: docker/setup-buildx-action@v2
141+
142+
- name: Login to DockerHub
143+
uses: docker/login-action@v2
144+
with:
145+
username: ${{ secrets.DOCKERHUB_USERNAME }}
146+
password: ${{ secrets.DOCKERHUB_TOKEN }}
147+
148+
- name: Set Docker tags
149+
id: docker_tags
150+
run: |
151+
if [[ ${{ github.event.release.tag_name }} == "preview" ]]; then
152+
echo "::set-output name=preview::true"
153+
else
154+
echo "::set-output name=preview::false"
155+
fi
156+
157+
- name: Build and push Docker image
158+
uses: docker/build-push-action@v4
159+
with:
160+
context: .
161+
file: ./Dockerfile
162+
push: true
163+
tags: |
164+
${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }}
165+
${{ env.DOCKER_IMAGE_NAME }}:latest
166+
if: steps.docker_tags.outputs.preview == 'false'
167+
168+
- name: Build and push Docker image without latest tag (preview release)
169+
uses: docker/build-push-action@v4
170+
with:
171+
context: .
172+
file: ./Dockerfile
173+
push: true
174+
tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }}
175+
if: steps.docker_tags.outputs.preview == 'true'

0 commit comments

Comments
 (0)