-
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (174 loc) · 6.73 KB
/
Copy pathpublish.yaml
File metadata and controls
204 lines (174 loc) · 6.73 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Publish to CharmHub
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
channel:
description: 'CharmHub channel to publish to'
required: true
default: 'edge'
type: choice
options:
- edge
- beta
- candidate
- stable
jobs:
publish:
name: Build and Publish Charm
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install Charmcraft
run: |
sudo snap install charmcraft --classic
- name: Get version from tag
id: get_version
run: |
if [ "${{ github.event_name }}" = "push" ]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION=$(git describe --tags --always)
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Update charm version in metadata
run: |
# Optional: Add version to metadata if needed
echo "Building version ${{ steps.get_version.outputs.version }}"
- name: Pack charm
run: |
charmcraft pack --verbose --destructive-mode
- name: Upload charm artifact
uses: actions/upload-artifact@v7
with:
name: openclaw-charm
path: openclaw_*.charm
retention-days: 30
- name: Upload charm to CharmHub
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_TOKEN }}
run: |
CHARM_FILE=$(ls openclaw_*.charm | head -1)
echo "Uploading $CHARM_FILE to CharmHub..."
charmcraft upload $CHARM_FILE --name openclaw --format json > upload-result.json
cat upload-result.json
REVISION=$(jq -r '.revision' upload-result.json)
echo "revision=$REVISION" >> $GITHUB_ENV
echo "Uploaded as revision $REVISION"
- name: Determine target channel
id: channel
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
CHANNEL="${{ github.event.inputs.channel }}"
elif [[ "${{ github.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Release tag (vX.Y.Z) -> candidate channel
CHANNEL="candidate"
elif [[ "${{ github.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then
# RC tag -> beta channel
CHANNEL="beta"
else
# All other tags -> edge channel
CHANNEL="edge"
fi
echo "channel=$CHANNEL" >> $GITHUB_OUTPUT
echo "Target channel: $CHANNEL"
- name: Release to channel
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_TOKEN }}
run: |
CHANNEL="${{ steps.channel.outputs.channel }}"
echo "Releasing revision ${{ env.revision }} to $CHANNEL channel..."
charmcraft release openclaw \
--revision=${{ env.revision }} \
--channel=$CHANNEL
echo "✓ Successfully released to $CHANNEL channel"
- name: Get CharmHub status
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_TOKEN }}
run: |
echo "Current CharmHub status:"
charmcraft status openclaw
- name: Create GitHub Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: openclaw_*.charm
body: |
## OpenClaw Juju Charm ${{ steps.get_version.outputs.version }}
### Installation
```bash
juju deploy openclaw --channel=${{ steps.channel.outputs.channel }}
```
### What's Included
- OpenClaw Gateway service
- Systemd service management
- Multi-platform messaging support
- Configurable AI providers
- Security hardening
### Documentation
- [Charm Documentation](https://fourdollars.github.io/openclaw-charm/)
- [OpenClaw Docs](https://docs.openclaw.ai)
- [CharmHub Page](https://charmhub.io/openclaw)
### CharmHub
Published to **${{ steps.channel.outputs.channel }}** channel as revision **${{ env.revision }}**
draft: false
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-alpha') || contains(github.ref, '-beta') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify on success
if: success()
run: |
echo "🎉 Charm successfully published!"
echo "Channel: ${{ steps.channel.outputs.channel }}"
echo "Revision: ${{ env.revision }}"
echo "Version: ${{ steps.get_version.outputs.version }}"
echo ""
echo "Install with: juju deploy openclaw --channel=${{ steps.channel.outputs.channel }}"
- name: Notify on failure
if: failure()
run: |
echo "❌ Charm publication failed"
echo "Check the logs above for details"
exit 1
promote-to-stable:
name: Promote to Stable
runs-on: ubuntu-24.04
needs: publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')
environment:
name: stable
url: https://charmhub.io/openclaw
steps:
- name: Install Charmcraft
run: |
sudo snap install charmcraft --classic
- name: Wait for manual approval
run: |
echo "⏳ Waiting for manual approval to promote to stable channel..."
echo "This is the final step before production release."
- name: Promote to stable
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_TOKEN }}
run: |
# Get the latest revision from candidate channel
REVISION=$(charmcraft status openclaw --format json | jq -r '.[] | select(.channel == "candidate") | .revision' | head -1)
echo "Promoting revision $REVISION from candidate to stable..."
charmcraft release openclaw \
--revision=$REVISION \
--channel=stable
echo "✓ Successfully promoted to stable channel!"
- name: Verify stable release
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_TOKEN }}
run: |
echo "Verifying stable channel release..."
charmcraft status openclaw
echo ""
echo "🎉 Charm is now available on stable channel!"
echo "Install with: juju deploy openclaw"