WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit dfeccbd

Browse files
Copilotcommjoen
andcommitted
Add GHCR support for wrongsecrets desktop containers
- Created GitHub Actions workflow to build and publish desktop containers - Supports both Dockerfile_webdesktop and Dockerfile_webdesktopk8s - Multi-platform builds (AMD64 and ARM64) - Publishes to GitHub Container Registry (GHCR) - Handles build secrets required by desktop Dockerfiles - Follows same patterns as existing master container workflow Co-authored-by: commjoen <[email protected]>
1 parent c8a1cab commit dfeccbd

File tree

1 file changed

+145
-0
lines changed

1 file changed

+145
-0
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Build and Publish Desktop Containers
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
packages: write
12+
13+
jobs:
14+
build-and-publish-desktop:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
container:
19+
- name: "webdesktop"
20+
dockerfile: "Dockerfile_webdesktop"
21+
image_name: "wrongsecrets-desktop"
22+
- name: "webdesktop-k8s"
23+
dockerfile: "Dockerfile_webdesktopk8s"
24+
image_name: "wrongsecrets-desktop-k8s"
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v5
28+
29+
- name: Set up JDK 23
30+
uses: actions/setup-java@v5
31+
with:
32+
java-version: "23"
33+
distribution: "temurin"
34+
cache: "maven"
35+
36+
- name: Extract version from pom.xml
37+
id: extract-version
38+
run: |
39+
echo "Extracting version from pom.xml..."
40+
chmod +x ./mvnw
41+
VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
42+
DOCKER_VERSION=${VERSION%-SNAPSHOT}
43+
echo "version=$VERSION" >> $GITHUB_OUTPUT
44+
echo "docker_version=$DOCKER_VERSION" >> $GITHUB_OUTPUT
45+
echo "Detected version: $VERSION"
46+
echo "Docker version: $DOCKER_VERSION"
47+
48+
- name: Build application
49+
run: ./mvnw --no-transfer-progress clean package -DskipTests
50+
51+
- name: Verify JAR file was created
52+
run: |
53+
echo "Checking target directory..."
54+
ls -la target/
55+
echo "Looking for JAR files..."
56+
find target/ -name "*.jar" -type f
57+
echo "Verifying specific JAR exists..."
58+
JAR_FILE="target/wrongsecrets-${{ steps.extract-version.outputs.version }}.jar"
59+
if [ -f "$JAR_FILE" ]; then
60+
echo "✅ JAR file found: $JAR_FILE"
61+
ls -la "$JAR_FILE"
62+
else
63+
echo "❌ Expected JAR file not found: $JAR_FILE"
64+
echo "Available JAR files:"
65+
find target/ -name "*.jar" -type f || echo "No JAR files found"
66+
exit 1
67+
fi
68+
69+
- name: Set up Docker Buildx
70+
uses: docker/setup-buildx-action@v3
71+
72+
- name: Log in to GitHub Container Registry
73+
uses: docker/login-action@v3
74+
with:
75+
registry: ghcr.io
76+
username: ${{ github.actor }}
77+
password: ${{ secrets.GITHUB_TOKEN }}
78+
79+
- name: Extract metadata
80+
id: meta
81+
uses: docker/metadata-action@v5
82+
with:
83+
images: ghcr.io/${{ github.repository }}/${{ matrix.image_name }}
84+
tags: |
85+
type=ref,event=branch
86+
type=raw,value=latest-master
87+
type=sha,prefix={{branch}}-
88+
89+
- name: Create secret file for build
90+
run: |
91+
echo "wrongsecret-3" > /tmp/mysecret.txt
92+
93+
- name: Build and push Docker image
94+
id: build
95+
uses: docker/build-push-action@v6
96+
with:
97+
platforms: linux/amd64,linux/arm64
98+
context: .
99+
file: ${{ matrix.dockerfile }}
100+
push: true
101+
tags: ${{ steps.meta.outputs.tags }}
102+
labels: ${{ steps.meta.outputs.labels }}
103+
build-args: |
104+
argBasedVersion=${{ steps.extract-version.outputs.docker_version }}
105+
secrets: |
106+
mysecret=/tmp/mysecret.txt
107+
cache-from: type=gha,scope=${{ matrix.name }}
108+
cache-to: type=gha,mode=max,scope=${{ matrix.name }}
109+
110+
- name: Verify Docker image was built
111+
run: |
112+
echo "Verifying Docker image was built successfully..."
113+
echo "Container: ${{ matrix.name }}"
114+
echo "Dockerfile: ${{ matrix.dockerfile }}"
115+
echo "Image tags: ${{ steps.meta.outputs.tags }}"
116+
echo "Image digest: ${{ steps.build.outputs.digest }}"
117+
118+
create-summary:
119+
runs-on: ubuntu-latest
120+
needs: build-and-publish-desktop
121+
steps:
122+
- name: Create Release Summary
123+
run: |
124+
echo "## 🖥️ Desktop Containers Published" >> $GITHUB_STEP_SUMMARY
125+
echo "" >> $GITHUB_STEP_SUMMARY
126+
echo "**📦 Container Images Published:**" >> $GITHUB_STEP_SUMMARY
127+
echo "" >> $GITHUB_STEP_SUMMARY
128+
echo "- \`ghcr.io/${{ github.repository }}/wrongsecrets-desktop:latest-master\`" >> $GITHUB_STEP_SUMMARY
129+
echo "- \`ghcr.io/${{ github.repository }}/wrongsecrets-desktop-k8s:latest-master\`" >> $GITHUB_STEP_SUMMARY
130+
echo "" >> $GITHUB_STEP_SUMMARY
131+
echo "**🐳 Try the desktop environments:**" >> $GITHUB_STEP_SUMMARY
132+
echo "" >> $GITHUB_STEP_SUMMARY
133+
echo "**Standard Desktop:**" >> $GITHUB_STEP_SUMMARY
134+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
135+
echo "docker pull ghcr.io/${{ github.repository }}/wrongsecrets-desktop:latest-master" >> $GITHUB_STEP_SUMMARY
136+
echo "docker run -d -p 3000:3000 ghcr.io/${{ github.repository }}/wrongsecrets-desktop:latest-master" >> $GITHUB_STEP_SUMMARY
137+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
138+
echo "" >> $GITHUB_STEP_SUMMARY
139+
echo "**Kubernetes Desktop:**" >> $GITHUB_STEP_SUMMARY
140+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
141+
echo "docker pull ghcr.io/${{ github.repository }}/wrongsecrets-desktop-k8s:latest-master" >> $GITHUB_STEP_SUMMARY
142+
echo "docker run -d -p 3000:3000 ghcr.io/${{ github.repository }}/wrongsecrets-desktop-k8s:latest-master" >> $GITHUB_STEP_SUMMARY
143+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
144+
echo "" >> $GITHUB_STEP_SUMMARY
145+
echo "Then visit: http://localhost:3000" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)