Skip to content

Commit 8f8f185

Browse files
committed
Added Github Marketplace Basics
1 parent a17dfc0 commit 8f8f185

3 files changed

Lines changed: 483 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Release and Publish to Marketplace
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Extract version from tag
17+
id: version
18+
run: |
19+
TAG_NAME=${GITHUB_REF#refs/tags/}
20+
echo "version=$TAG_NAME" >> $GITHUB_OUTPUT
21+
echo "version_number=${TAG_NAME#v}" >> $GITHUB_OUTPUT
22+
23+
- name: Verify action.yml exists
24+
run: |
25+
if [ ! -f action.yml ]; then
26+
echo "Error: action.yml not found"
27+
exit 1
28+
fi
29+
echo "✅ action.yml found"
30+
31+
- name: Validate action structure
32+
run: |
33+
# Check if required files exist
34+
required_files=("action.yml" "Dockerfile" "entrypoint.sh" "README.md")
35+
for file in "${required_files[@]}"; do
36+
if [ ! -f "$file" ]; then
37+
echo "❌ Required file missing: $file"
38+
exit 1
39+
else
40+
echo "✅ Found: $file"
41+
fi
42+
done
43+
44+
- name: Test action locally
45+
run: |
46+
# Basic validation that the Docker image can be built
47+
echo "Testing Docker image build..."
48+
docker build -t ssh-action-test .
49+
echo "✅ Docker image built successfully"
50+
51+
- name: Generate release notes
52+
id: release_notes
53+
run: |
54+
cat > release_notes.md << 'EOF'
55+
## SSH Remote Script Executor ${{ steps.version.outputs.version }}
56+
57+
### What's New
58+
- Execute scripts on remote hosts via SSH
59+
- Support for custom SSH ports
60+
- Password-based authentication
61+
- Comprehensive error handling
62+
63+
### Features
64+
- ✅ Remote script execution via SSH
65+
- ✅ Configurable SSH port (default: 22)
66+
- ✅ Password authentication with sshpass
67+
- ✅ Multi-line script support
68+
- ✅ Proper error handling and validation
69+
- ✅ Security best practices
70+
71+
### Usage
72+
```yaml
73+
- name: Execute remote script
74+
uses: your-username/ssh-action@${{ steps.version.outputs.version }}
75+
with:
76+
host: ${{ secrets.SERVER_HOST }}
77+
username: ${{ secrets.SERVER_USER }}
78+
password: ${{ secrets.SERVER_PASSWORD }}
79+
script: |
80+
echo "Hello from remote server!"
81+
uptime
82+
```
83+
84+
### Security
85+
- Always use GitHub Secrets for sensitive credentials
86+
- Never hardcode passwords in workflow files
87+
- Use principle of least privilege for SSH users
88+
89+
See [README.md](README.md) for complete documentation and examples.
90+
EOF
91+
92+
echo "Generated release notes:"
93+
cat release_notes.md
94+
95+
- name: Create GitHub Release
96+
id: create_release
97+
uses: actions/create-release@v1
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
with:
101+
tag_name: ${{ steps.version.outputs.version }}
102+
release_name: SSH Remote Script Executor ${{ steps.version.outputs.version }}
103+
body_path: release_notes.md
104+
draft: false
105+
prerelease: false
106+
107+
- name: Marketplace Publication Info
108+
run: |
109+
echo "🎉 Release created successfully!"
110+
echo "📦 Your action will be automatically available on GitHub Marketplace"
111+
echo "🔗 Release URL: ${{ steps.create_release.outputs.html_url }}"
112+
echo ""
113+
echo "ℹ️ To publish to GitHub Marketplace:"
114+
echo " 1. Ensure your repository is public"
115+
echo " 2. The action.yml file has proper branding (✅ already configured)"
116+
echo " 3. Go to your repository's main page"
117+
echo " 4. Click 'Publish this Action to the GitHub Marketplace'"
118+
echo " 5. Fill in the marketplace details and submit"
119+
120+
# Job to create/update major version tag (e.g., v1, v2)
121+
update-major-tag:
122+
runs-on: ubuntu-latest
123+
needs: release
124+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
125+
126+
steps:
127+
- name: Checkout repository
128+
uses: actions/checkout@v4
129+
with:
130+
fetch-depth: 0
131+
132+
- name: Extract major version
133+
id: major_version
134+
run: |
135+
TAG_NAME=${GITHUB_REF#refs/tags/}
136+
MAJOR_VERSION=$(echo $TAG_NAME | cut -d. -f1)
137+
echo "major_version=$MAJOR_VERSION" >> $GITHUB_OUTPUT
138+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
139+
140+
- name: Update major version tag
141+
run: |
142+
git config user.name "GitHub Actions"
143+
git config user.email "actions@github.com"
144+
145+
# Delete the major version tag if it exists
146+
git tag -d ${{ steps.major_version.outputs.major_version }} || true
147+
git push origin :refs/tags/${{ steps.major_version.outputs.major_version }} || true
148+
149+
# Create new major version tag pointing to current commit
150+
git tag ${{ steps.major_version.outputs.major_version }}
151+
git push origin ${{ steps.major_version.outputs.major_version }}
152+
153+
echo "✅ Updated major version tag: ${{ steps.major_version.outputs.major_version }}"

RELEASING.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Release Guide
2+
3+
This guide explains how to release new versions of the SSH Remote Script Executor action and publish them to GitHub Marketplace.
4+
5+
## Quick Release
6+
7+
Use the provided release script for easy version management:
8+
9+
```bash
10+
./scripts/release.sh 1.0.0
11+
```
12+
13+
This will:
14+
- ✅ Validate version format and repository state
15+
- ✅ Create and push the version tag
16+
- ✅ Trigger the automated release workflow
17+
- ✅ Update major version tags (v1, v2, etc.)
18+
19+
## Manual Release Process
20+
21+
### 1. Prepare for Release
22+
23+
Ensure your repository is ready:
24+
25+
```bash
26+
# Check that all files are present
27+
ls -la action.yml Dockerfile entrypoint.sh README.md
28+
29+
# Ensure working directory is clean
30+
git status
31+
32+
# Make sure you're on main branch
33+
git checkout main
34+
git pull origin main
35+
```
36+
37+
### 2. Create Release Tag
38+
39+
```bash
40+
# Create and push a semantic version tag
41+
git tag -a v1.0.0 -m "Release v1.0.0"
42+
git push origin v1.0.0
43+
```
44+
45+
### 3. Automated Release Workflow
46+
47+
The workflow (`.github/workflows/release.yml`) will automatically:
48+
49+
1. **Validate** - Check that all required files exist
50+
2. **Test** - Build Docker image to ensure it works
51+
3. **Release** - Create GitHub release with generated notes
52+
4. **Tag Management** - Update major version tags (v1, v2, etc.)
53+
54+
### 4. Publish to GitHub Marketplace
55+
56+
After the release is created:
57+
58+
1. **Navigate to your repository** on GitHub
59+
2. **Go to the main page** and look for the marketplace banner
60+
3. **Click "Publish this Action to the GitHub Marketplace"**
61+
4. **Fill in the marketplace details**:
62+
- Action name: `SSH Remote Script Executor`
63+
- Description: `Execute scripts on remote hosts via SSH`
64+
- Categories: `Deployment`, `Utilities`
65+
- Tags: `ssh`, `remote`, `deployment`, `scripts`
66+
5. **Submit for publication**
67+
68+
## Version Management
69+
70+
### Semantic Versioning
71+
72+
Follow [Semantic Versioning](https://semver.org/) (MAJOR.MINOR.PATCH):
73+
74+
- **MAJOR** version when you make incompatible API changes
75+
- **MINOR** version when you add functionality in a backwards compatible manner
76+
- **PATCH** version when you make backwards compatible bug fixes
77+
78+
### Examples:
79+
- `v1.0.0` - Initial release
80+
- `v1.0.1` - Bug fix
81+
- `v1.1.0` - New feature (backwards compatible)
82+
- `v2.0.0` - Breaking change
83+
84+
### Major Version Tags
85+
86+
The release workflow automatically maintains major version tags:
87+
- `v1.0.0` → creates/updates `v1` tag
88+
- `v1.0.1` → updates `v1` tag
89+
- `v2.0.0` → creates/updates `v2` tag
90+
91+
This allows users to reference stable major versions:
92+
```yaml
93+
uses: your-username/ssh-action@v1 # Always latest v1.x.x
94+
uses: your-username/ssh-action@v1.0.0 # Specific version
95+
```
96+
97+
## Pre-release Checklist
98+
99+
Before creating a release:
100+
101+
- [ ] All tests pass
102+
- [ ] README is updated with new features
103+
- [ ] Breaking changes are documented
104+
- [ ] Version follows semantic versioning
105+
- [ ] Changelog is updated (if you maintain one)
106+
- [ ] All required files are present
107+
- [ ] Docker image builds successfully
108+
109+
## Release Notes Template
110+
111+
The workflow generates release notes automatically, but you can customize them:
112+
113+
```markdown
114+
## SSH Remote Script Executor v1.0.0
115+
116+
### What's New
117+
- New feature descriptions
118+
- Improvements and enhancements
119+
- Bug fixes
120+
121+
### Breaking Changes
122+
- List any breaking changes
123+
124+
### Usage
125+
```yaml
126+
- uses: your-username/ssh-action@v1.0.0
127+
with:
128+
host: ${{ secrets.SERVER_HOST }}
129+
# ... other parameters
130+
```
131+
132+
### Migration Guide
133+
- Instructions for upgrading from previous versions
134+
```
135+
136+
## Troubleshooting
137+
138+
### Release Workflow Fails
139+
140+
1. **Check workflow logs** in the Actions tab
141+
2. **Common issues**:
142+
- Missing required files
143+
- Docker build failures
144+
- Permission issues with `GITHUB_TOKEN`
145+
146+
### Marketplace Publication Issues
147+
148+
1. **Repository must be public** for marketplace publication
149+
2. **action.yml must have proper branding** (✅ already configured)
150+
3. **Check GitHub's marketplace requirements**
151+
152+
### Tag Already Exists
153+
154+
```bash
155+
# Delete local tag
156+
git tag -d v1.0.0
157+
158+
# Delete remote tag
159+
git push origin --delete v1.0.0
160+
161+
# Create new tag
162+
git tag -a v1.0.0 -m "Release v1.0.0"
163+
git push origin v1.0.0
164+
```
165+
166+
## GitHub Marketplace Requirements
167+
168+
To publish to GitHub Marketplace, ensure:
169+
170+
1. ✅ Repository is public
171+
2. ✅ Valid `action.yml` in repository root
172+
3. ✅ Proper branding in `action.yml`
173+
4. ✅ Comprehensive README with usage examples
174+
5. ✅ Valid semantic version tags
175+
6. ✅ Action actually works (tested)
176+
177+
## Support
178+
179+
For issues with the release process:
180+
1. Check the workflow logs in the Actions tab
181+
2. Review this guide
182+
3. Create an issue in the repository
183+
184+
Happy releasing! 🚀

0 commit comments

Comments
 (0)