-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (39 loc) · 1.28 KB
/
release-docker.yml
File metadata and controls
45 lines (39 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Publish Docker Image
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
IMAGE_NAME: ghcr.io/drill4j/java-agent
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Determine current tag
id: get_tag
run: |
TAG=$(git describe --exact-match --tags $(git rev-parse HEAD) 2>/dev/null || true)
if [ -z "$TAG" ]; then
echo "ERROR: Current commit is not tagged"
exit 1
fi
# Strip leading 'v' if present
VERSION=${TAG#v}
echo "DRILL_AGENT_VERSION=$VERSION" >> $GITHUB_ENV
echo "Tag detected: $TAG -> Docker tag: $VERSION"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build agent image
run: |
echo "Building Drill agent version $DRILL_AGENT_VERSION"
docker build --build-arg DRILL_AGENT_VERSION=$DRILL_AGENT_VERSION -t $IMAGE_NAME:$DRILL_AGENT_VERSION .
- name: Push agent image
run: |
docker push $IMAGE_NAME:$DRILL_AGENT_VERSION