Skip to content

Commit 438361f

Browse files
committed
Add Woodpecker CI plugin workflow
1 parent 9b91437 commit 438361f

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
name: Woodpecker Plugin - Build and Publish
3+
4+
on:
5+
push:
6+
branches: [main, feat/woodpecker-ci-plugin]
7+
paths:
8+
- 'woodpecker-plugin/**'
9+
- 'common/**'
10+
- '.github/workflows/woodpecker-plugin.yml'
11+
pull_request:
12+
paths:
13+
- 'woodpecker-plugin/**'
14+
- 'common/**'
15+
- '.github/workflows/woodpecker-plugin.yml'
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
jobs:
23+
build-and-push:
24+
name: Build and push Woodpecker plugin image
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Log in to GitHub Container Registry
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.repository_owner }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Extract metadata (tags, labels)
41+
id: meta
42+
uses: docker/metadata-action@v5
43+
with:
44+
images: ghcr.io/${{ github.repository_owner }}/devcontainer-build-run-woodpecker
45+
tags: |
46+
# Tag as 'latest' for pushes to main
47+
type=raw,value=latest,enable={{is_default_branch}}
48+
# Tag as 'pr-NUMBER' for pull requests
49+
type=ref,event=pr,prefix=pr-
50+
# Tag as branch name for other branches
51+
type=ref,event=branch
52+
# Tag as sha for commits
53+
type=sha,prefix={{branch}}-
54+
55+
- name: Build and push Docker image
56+
uses: docker/build-push-action@v6
57+
with:
58+
context: .
59+
file: ./woodpecker-plugin/Dockerfile
60+
push: true
61+
tags: ${{ steps.meta.outputs.tags }}
62+
labels: ${{ steps.meta.outputs.labels }}
63+
cache-from: type=gha
64+
cache-to: type=gha,mode=max
65+
66+
- name: Show image details
67+
run: |
68+
echo "## Woodpecker Plugin Image Published! 🎉" >> $GITHUB_STEP_SUMMARY
69+
echo "" >> $GITHUB_STEP_SUMMARY
70+
echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY
71+
echo '```' >> $GITHUB_STEP_SUMMARY
72+
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
73+
echo '```' >> $GITHUB_STEP_SUMMARY
74+
echo "" >> $GITHUB_STEP_SUMMARY
75+
echo "**Usage in Woodpecker CI:**" >> $GITHUB_STEP_SUMMARY
76+
echo '```yaml' >> $GITHUB_STEP_SUMMARY
77+
echo "steps:" >> $GITHUB_STEP_SUMMARY
78+
echo " - name: build-devcontainer" >> $GITHUB_STEP_SUMMARY
79+
echo " image: ghcr.io/${{ github.repository_owner }}/devcontainer-build-run-woodpecker:latest" >> $GITHUB_STEP_SUMMARY
80+
echo " settings:" >> $GITHUB_STEP_SUMMARY
81+
echo " sub_folder: .devcontainer" >> $GITHUB_STEP_SUMMARY
82+
echo " image_name: my-devcontainer" >> $GITHUB_STEP_SUMMARY
83+
echo " image_tag: latest" >> $GITHUB_STEP_SUMMARY
84+
echo '```' >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)