-
Notifications
You must be signed in to change notification settings - Fork 91
85 lines (77 loc) · 2.94 KB
/
woodpecker-plugin.yml
File metadata and controls
85 lines (77 loc) · 2.94 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
name: Woodpecker Plugin - Build and Publish
on:
push:
branches: [main, feat/woodpecker-ci-plugin]
paths:
- 'woodpecker-plugin/**'
- 'common/**'
- '.github/workflows/woodpecker-plugin.yml'
pull_request:
paths:
- 'woodpecker-plugin/**'
- 'common/**'
- '.github/workflows/woodpecker-plugin.yml'
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-and-push:
name: Build and push Woodpecker plugin image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/devcontainer-build-run-woodpecker
tags: |
# Tag as 'latest' for pushes to main
type=raw,value=latest,enable={{is_default_branch}}
# Tag as 'pr-NUMBER' for pull requests
type=ref,event=pr,prefix=pr-
# Tag as branch name for other branches
type=ref,event=branch
# Tag as sha for commits
type=sha,prefix={{branch}}-
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./woodpecker-plugin/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Show image details
run: |
echo "## Woodpecker Plugin Image Published! 🎉" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Usage in Woodpecker CI:**" >> $GITHUB_STEP_SUMMARY
echo '```yaml' >> $GITHUB_STEP_SUMMARY
echo "steps:" >> $GITHUB_STEP_SUMMARY
echo " - name: build-devcontainer" >> $GITHUB_STEP_SUMMARY
echo " image: ghcr.io/${{ github.repository_owner }}/devcontainer-build-run-woodpecker:latest" >> $GITHUB_STEP_SUMMARY
echo " settings:" >> $GITHUB_STEP_SUMMARY
echo " sub_folder: .devcontainer" >> $GITHUB_STEP_SUMMARY
echo " image_name: my-devcontainer" >> $GITHUB_STEP_SUMMARY
echo " image_tag: latest" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY