44 branches :
55 - master
66 workflow_dispatch :
7+ inputs :
8+ tag_suffix :
9+ description : ' Optional tag suffix (e.g., "test-feature")'
10+ required : false
11+ default : ' '
712
813jobs :
914 build :
3944 WEBAPP_RELEASE=$(curl -sX GET "https://api.github.com/repos/netbootxyz/webapp/releases/latest" | jq -r '. | .tag_name')
4045 echo "WEBAPP_RELEASE=${WEBAPP_RELEASE}" >> $GITHUB_ENV
4146
47+ - name : Determine tag strategy
48+ id : tags
49+ run : |
50+ if [ "${{ github.event_name }}" == "pull_request" ]; then
51+ echo "TAG_SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
52+ echo "IS_PR=true" >> $GITHUB_ENV
53+ elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
54+ if [ -n "${{ github.event.inputs.tag_suffix }}" ]; then
55+ echo "TAG_SUFFIX=test-${{ github.event.inputs.tag_suffix }}" >> $GITHUB_ENV
56+ else
57+ echo "TAG_SUFFIX=test-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV
58+ fi
59+ echo "IS_PR=false" >> $GITHUB_ENV
60+ fi
61+
4262 - name : Build and push PR test image
4363 uses : docker/build-push-action@v6
4464 with :
@@ -48,26 +68,82 @@ jobs:
4868 platforms : linux/amd64,linux/arm64
4969 build-args : |
5070 WEBAPP_VERSION=${{ env.WEBAPP_RELEASE }}
51- VERSION=pr- ${{ github.event.number }}
71+ VERSION=${{ env.TAG_SUFFIX }}
5272 BUILD_DATE=$(date +'%Y-%m-%dT%H:%M:%S')
5373 tags : |
54- netbootxyz/netbootxyz:pr- ${{ github.event.number }}
55- netbootxyz/netbootxyz:pr- ${{ github.event.number }}-${{ github.sha }}
56- ghcr.io/netbootxyz/netbootxyz:pr- ${{ github.event.number }}
57- ghcr.io/netbootxyz/netbootxyz:pr- ${{ github.event.number }}-${{ github.sha }}
74+ netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}
75+ netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}-${{ github.sha }}
76+ ghcr.io/netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}
77+ ghcr.io/netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}-${{ github.sha }}
5878 labels : |
5979 org.opencontainers.image.title=netbootxyz
60- org.opencontainers.image.description=netboot.xyz PR test image
61- org.opencontainers.image.version=pr- ${{ github.event.number }}
80+ org.opencontainers.image.description=netboot.xyz test image
81+ org.opencontainers.image.version=${{ env.TAG_SUFFIX }}
6282 org.opencontainers.image.revision=${{ github.sha }}
6383 org.opencontainers.image.source=https://github.com/netbootxyz/docker-netbootxyz
6484
6585 - name : Run Trivy vulnerability scanner
6686 uses : aquasecurity/trivy-action@0.33.1
6787 with :
68- image-ref : ' ghcr.io/netbootxyz/netbootxyz:pr- ${{ github.event.number }}'
88+ image-ref : ' ghcr.io/netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}'
6989 format : ' table'
70- exit-code : ' 1 '
90+ exit-code : ' 0 '
7191 ignore-unfixed : true
7292 vuln-type : ' os,library'
7393 severity : ' CRITICAL,HIGH'
94+
95+ - name : Comment on PR with test instructions
96+ if : github.event_name == 'pull_request'
97+ uses : actions/github-script@v7
98+ with :
99+ script : |
100+ const comment = `## 🚀 Test Image Built Successfully!
101+
102+ Your PR test images have been published and are ready for testing:
103+
104+ ### Docker Hub
105+ \`\`\`bash
106+ docker pull netbootxyz/netbootxyz:pr-${{ github.event.number }}
107+ \`\`\`
108+
109+ ### GitHub Container Registry
110+ \`\`\`bash
111+ docker pull ghcr.io/netbootxyz/netbootxyz:pr-${{ github.event.number }}
112+ \`\`\`
113+
114+ ### Quick Test Commands
115+
116+ **Standard Docker:**
117+ \`\`\`bash
118+ docker run -d \\
119+ --name netbootxyz-test \\
120+ -e PUID=1000 \\
121+ -e PGID=1000 \\
122+ -p 3000:3000 \\
123+ -p 69:69/udp \\
124+ -p 8080:80 \\
125+ -v /local/path/config:/config \\
126+ netbootxyz/netbootxyz:pr-${{ github.event.number }}
127+ \`\`\`
128+
129+ ### Platforms
130+ - ✅ linux/amd64
131+ - ✅ linux/arm64
132+
133+ ### Check Logs
134+ \`\`\`bash
135+ docker logs -f netbootxyz-test
136+ \`\`\`
137+
138+ ---
139+ 📦 **SHA:** \`${{ github.sha }}\`
140+ 🏷️ **Webapp Version:** \`${{ env.WEBAPP_RELEASE }}\`
141+ `;
142+
143+ github.rest.issues.createComment({
144+ issue_number: context.issue.number,
145+ owner: context.repo.owner,
146+ repo: context.repo.repo,
147+ body: comment
148+ });
149+
0 commit comments