Skip to content

Commit 4685713

Browse files
docker release
1 parent 637de6f commit 4685713

File tree

2 files changed

+82
-129
lines changed

2 files changed

+82
-129
lines changed

.github/workflows/docker.yml

Lines changed: 0 additions & 127 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
permissions:
2222
contents: write
2323
pull-requests: write
24+
env:
25+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
26+
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
2427
steps:
2528
- name: Checkout
2629
uses: actions/checkout@v4
@@ -30,7 +33,7 @@ jobs:
3033
- name: Setup Node.js
3134
uses: actions/setup-node@v4
3235
with:
33-
node-version: '20'
36+
node-version: '22'
3437
registry-url: 'https://registry.npmjs.org'
3538

3639
- name: Install dependencies
@@ -104,6 +107,62 @@ jobs:
104107
git commit -m "chore: version packages" || echo "No changes to commit"
105108
git push
106109
110+
# Docker image publishing
111+
- name: Get Docker package versions
112+
id: versions
113+
run: |
114+
CLI_VERSION=$(node -p "require('./packages/cli/package.json').version")
115+
DOCKER_VERSION=$(node -p "require('./packages/docker/package.json').version")
116+
echo "cli=$CLI_VERSION" >> $GITHUB_OUTPUT
117+
echo "docker=$DOCKER_VERSION" >> $GITHUB_OUTPUT
118+
119+
- name: Check if CLI image exists
120+
id: check-cli
121+
run: |
122+
if docker manifest inspect walkeros/cli:${{ steps.versions.outputs.cli }} 2>/dev/null; then
123+
echo "exists=true" >> $GITHUB_OUTPUT
124+
else
125+
echo "exists=false" >> $GITHUB_OUTPUT
126+
fi
127+
128+
- name: Check if Docker image exists
129+
id: check-docker
130+
run: |
131+
if docker manifest inspect walkeros/docker:${{ steps.versions.outputs.docker }} 2>/dev/null; then
132+
echo "exists=true" >> $GITHUB_OUTPUT
133+
else
134+
echo "exists=false" >> $GITHUB_OUTPUT
135+
fi
136+
137+
- name: Login to Docker Hub
138+
if: steps.check-cli.outputs.exists == 'false' || steps.check-docker.outputs.exists == 'false'
139+
uses: docker/login-action@v3
140+
with:
141+
username: ${{ secrets.DOCKERHUB_USERNAME }}
142+
password: ${{ secrets.DOCKERHUB_TOKEN }}
143+
144+
- name: Build and push CLI image
145+
if: steps.check-cli.outputs.exists == 'false'
146+
uses: docker/build-push-action@v6
147+
with:
148+
context: ./packages/cli
149+
file: ./packages/cli/docker/Dockerfile
150+
push: true
151+
tags: |
152+
walkeros/cli:${{ steps.versions.outputs.cli }}
153+
walkeros/cli:${{ inputs.release_type == 'stable release' && 'latest' || 'next' }}
154+
155+
- name: Build and push Docker image
156+
if: steps.check-docker.outputs.exists == 'false'
157+
uses: docker/build-push-action@v6
158+
with:
159+
context: .
160+
file: ./packages/docker/Dockerfile
161+
push: true
162+
tags: |
163+
walkeros/docker:${{ steps.versions.outputs.docker }}
164+
walkeros/docker:${{ inputs.release_type == 'stable release' && 'latest' || 'next' }}
165+
107166
- name: Comment on PR
108167
if: steps.publish.outputs.published != ''
109168
env:
@@ -116,17 +175,38 @@ jobs:
116175
EMOJI="📦"
117176
TITLE="Pre-release published (next)"
118177
INSTALL_TAG="@next"
178+
DOCKER_TAG=":next"
119179
else
120180
EMOJI="🚀"
121181
TITLE="Stable release published"
122182
INSTALL_TAG="@latest"
183+
DOCKER_TAG=":latest"
184+
fi
185+
186+
# Build Docker section if any images were published
187+
DOCKER_SECTION=""
188+
if [ "${{ steps.check-cli.outputs.exists }}" = "false" ] || [ "${{ steps.check-docker.outputs.exists }}" = "false" ]; then
189+
DOCKER_SECTION="
190+
191+
🐳 **Docker images published**"
192+
if [ "${{ steps.check-cli.outputs.exists }}" = "false" ]; then
193+
DOCKER_SECTION="$DOCKER_SECTION
194+
- walkeros/cli:${{ steps.versions.outputs.cli }} ($DOCKER_TAG)"
195+
fi
196+
if [ "${{ steps.check-docker.outputs.exists }}" = "false" ]; then
197+
DOCKER_SECTION="$DOCKER_SECTION
198+
- walkeros/docker:${{ steps.versions.outputs.docker }} ($DOCKER_TAG)"
199+
fi
200+
DOCKER_SECTION="$DOCKER_SECTION
201+
202+
Docker: \`docker pull walkeros/cli$DOCKER_TAG\`"
123203
fi
124204
125205
BODY="$EMOJI **$TITLE**
126206
127207
${{ steps.publish.outputs.published }}
128208
129-
Install: \`npm i @walkeros/core$INSTALL_TAG\`"
209+
Install: \`npm i @walkeros/core$INSTALL_TAG\`$DOCKER_SECTION"
130210
131211
gh pr comment "$PR_NUMBER" --body "$BODY"
132212
echo "Commented on PR #$PR_NUMBER"

0 commit comments

Comments
 (0)