Skip to content

Commit a1c97d6

Browse files
committed
Release tagged Docker images
1 parent f0d3281 commit a1c97d6

2 files changed

Lines changed: 71 additions & 7 deletions

File tree

.github/workflows/build_release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,28 @@ name: Build Release
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
docker_tag:
7+
description: 'Docker image tag (leave empty to skip Docker push)'
8+
required: false
9+
default: ''
10+
type: string
511
workflow_call:
12+
inputs:
13+
docker_tag:
14+
description: 'Docker image tag (leave empty to skip Docker push)'
15+
required: false
16+
default: ''
17+
type: string
18+
secrets:
19+
DOCKERHUB_USERNAME:
20+
required: false
21+
DOCKERHUB_TOKEN:
22+
required: false
23+
outputs:
24+
image:
25+
description: 'Full Docker image reference'
26+
value: ${{ jobs.docker.outputs.image }}
627

728
jobs:
829
build:
@@ -69,3 +90,33 @@ jobs:
6990
oz-agent-worker-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
7091
oz-agent-worker-${{ matrix.goos }}-${{ matrix.goarch }}.tar.xz
7192
oz-agent-worker-${{ matrix.goos }}-${{ matrix.goarch }}.zip
93+
94+
docker:
95+
name: Build and push Docker image
96+
runs-on: namespace-profile-ubuntu-small
97+
outputs:
98+
image: "warpdotdev/oz-agent-worker@${{ steps.push.outputs.digest }}"
99+
steps:
100+
- name: Check out repository
101+
uses: actions/checkout@v6
102+
103+
- name: Log in to DockerHub
104+
uses: docker/login-action@v4
105+
with:
106+
username: ${{ secrets.DOCKERHUB_USERNAME }}
107+
password: ${{ secrets.DOCKERHUB_TOKEN }}
108+
109+
- name: Build and push image
110+
id: push
111+
uses: docker/build-push-action@v5
112+
with:
113+
context: .
114+
file: ./Dockerfile
115+
provenance: mode=max
116+
sbom: true
117+
# Only push tagged images.
118+
push: ${{ inputs.docker_tag != '' }}
119+
platforms: linux/amd64,linux/arm64
120+
tags: warpdotdev/oz-agent-worker:${{ inputs.docker_tag }}
121+
labels:
122+
dev.warp.worker-commit=${{ github.sha }}

.github/workflows/create_release.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,42 @@ on:
44
workflow_dispatch:
55

66
jobs:
7-
build:
7+
generate-tag:
88
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
9+
runs-on: namespace-profile-ubuntu-small
10+
outputs:
11+
tag_name: ${{ steps.tag.outputs.name }}
12+
steps:
13+
- name: Generate tag name
14+
id: tag
15+
run: echo "name=v$(date -u +'%Y-%m-%d-%H-%M-%S')" >> "$GITHUB_OUTPUT"
16+
17+
build:
18+
needs: generate-tag
919
uses: ./.github/workflows/build_release.yml
20+
secrets: inherit
21+
with:
22+
docker_tag: ${{ needs.generate-tag.outputs.tag_name }}
1023

1124
release:
12-
needs: build
25+
needs: [generate-tag, build]
1326
runs-on: namespace-profile-ubuntu-small
1427
permissions:
1528
contents: write
1629
steps:
17-
- name: Generate tag name
18-
id: tag
19-
run: echo "name=v$(date -u +'%Y-%m-%d-%H-%M-%S')" >> "$GITHUB_OUTPUT"
20-
2130
- name: Download artifacts
2231
uses: namespace-actions/download-artifact@v1
2332
with:
33+
# Only download release artifacts, not Docker image metadata.
34+
pattern: oz-agent-worker-*
2435
path: artifacts
2536

2637
- name: Create release
2738
uses: softprops/action-gh-release@v2
2839
with:
29-
tag_name: ${{ steps.tag.outputs.name }}
40+
tag_name: ${{ needs.generate-tag.outputs.tag_name }}
3041
target_commitish: ${{ github.sha }}
3142
generate_release_notes: true
43+
append_body: true
44+
body: "**Docker image:** `${{ needs.build.outputs.image }}`"
3245
files: artifacts/**/*

0 commit comments

Comments
 (0)