Skip to content

Commit 8f68da3

Browse files
committed
Release Fix
1 parent e8eae07 commit 8f68da3

File tree

2 files changed

+276
-12
lines changed

2 files changed

+276
-12
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
tags:
66
- 'v*.*.*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
77

8+
permissions:
9+
contents: write
10+
packages: write
11+
issues: write
12+
pull-requests: write
13+
814
jobs:
915
release:
1016
runs-on: ubuntu-latest
@@ -94,40 +100,47 @@ jobs:
94100
95101
- name: Create GitHub Release
96102
id: create_release
97-
uses: actions/create-release@v1
98103
env:
99104
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
105+
run: |
106+
gh release create ${{ steps.version.outputs.version }} \
107+
--title "SSH Remote Script Executor ${{ steps.version.outputs.version }}" \
108+
--notes-file release_notes.md \
109+
--latest
106110
107111
- name: Marketplace Publication Info
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108114
run: |
109115
echo "🎉 Release created successfully!"
110116
echo "📦 Your action will be automatically available on GitHub Marketplace"
111-
echo "🔗 Release URL: ${{ steps.create_release.outputs.html_url }}"
117+
echo "🔗 Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version }}"
112118
echo ""
113119
echo "ℹ️ To publish to GitHub Marketplace:"
114120
echo " 1. Ensure your repository is public"
115121
echo " 2. The action.yml file has proper branding (✅ already configured)"
116122
echo " 3. Go to your repository's main page"
117123
echo " 4. Click 'Publish this Action to the GitHub Marketplace'"
118124
echo " 5. Fill in the marketplace details and submit"
125+
echo ""
126+
echo "📊 You can also view the release directly:"
127+
gh release view ${{ steps.version.outputs.version }} --web || echo " View at: https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version }}"
119128
120129
# Job to create/update major version tag (e.g., v1, v2)
121130
update-major-tag:
122131
runs-on: ubuntu-latest
123132
needs: release
124133
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
125134

135+
permissions:
136+
contents: write
137+
126138
steps:
127139
- name: Checkout repository
128140
uses: actions/checkout@v4
129141
with:
130142
fetch-depth: 0
143+
token: ${{ secrets.GITHUB_TOKEN }}
131144

132145
- name: Extract major version
133146
id: major_version
@@ -136,18 +149,24 @@ jobs:
136149
MAJOR_VERSION=$(echo $TAG_NAME | cut -d. -f1)
137150
echo "major_version=$MAJOR_VERSION" >> $GITHUB_OUTPUT
138151
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
152+
echo "Extracted major version: $MAJOR_VERSION from tag: $TAG_NAME"
139153
140154
- name: Update major version tag
155+
env:
156+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141157
run: |
142158
git config user.name "GitHub Actions"
143159
git config user.email "actions@github.com"
144160
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
161+
echo "🏷️ Updating major version tag: ${{ steps.major_version.outputs.major_version }}"
162+
163+
# Delete the major version tag if it exists (both locally and remotely)
164+
git tag -d ${{ steps.major_version.outputs.major_version }} 2>/dev/null || echo "Local tag doesn't exist"
165+
git push origin :refs/tags/${{ steps.major_version.outputs.major_version }} 2>/dev/null || echo "Remote tag doesn't exist"
148166
149167
# Create new major version tag pointing to current commit
150168
git tag ${{ steps.major_version.outputs.major_version }}
151169
git push origin ${{ steps.major_version.outputs.major_version }}
152170
153-
echo "✅ Updated major version tag: ${{ steps.major_version.outputs.major_version }}"
171+
echo "✅ Updated major version tag: ${{ steps.major_version.outputs.major_version }}"
172+
echo "🎯 Users can now use: uses: ${{ github.repository }}@${{ steps.major_version.outputs.major_version }}"

TROUBLESHOOTING.md

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
# Troubleshooting GitHub Actions
2+
3+
This guide helps resolve common issues when setting up and running the SSH Remote Script Executor action.
4+
5+
## GitHub Actions Permission Issues
6+
7+
### Error: "Resource not accessible by integration"
8+
9+
**Problem**: The GitHub Actions workflow fails with permission errors.
10+
11+
**Solution**: This has been fixed in the latest version by:
12+
1. Adding explicit permissions to the workflow
13+
2. Using GitHub CLI instead of deprecated actions
14+
3. Proper token configuration
15+
16+
**What was changed**:
17+
```yaml
18+
permissions:
19+
contents: write
20+
packages: write
21+
issues: write
22+
pull-requests: write
23+
```
24+
25+
### Error: "actions/create-release@v1 is deprecated"
26+
27+
**Problem**: The old `actions/create-release@v1` action is deprecated and has permission issues.
28+
29+
**Solution**: Updated to use GitHub CLI (`gh`) which is more reliable:
30+
```yaml
31+
- name: Create GitHub Release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
run: |
35+
gh release create ${{ steps.version.outputs.version }} \
36+
--title "SSH Remote Script Executor ${{ steps.version.outputs.version }}" \
37+
--notes-file release_notes.md \
38+
--latest
39+
```
40+
41+
## Repository Setup Issues
42+
43+
### Repository Must Be Public
44+
45+
**Problem**: GitHub Marketplace requires public repositories.
46+
47+
**Solution**:
48+
1. Go to your repository Settings
49+
2. Scroll down to "Danger Zone"
50+
3. Click "Change repository visibility"
51+
4. Select "Make public"
52+
53+
### Missing Required Files
54+
55+
**Problem**: Release workflow fails because required files are missing.
56+
57+
**Solution**: Ensure these files exist:
58+
- `action.yml` (action metadata)
59+
- `Dockerfile` (container definition)
60+
- `entrypoint.sh` (executable script)
61+
- `README.md` (documentation)
62+
63+
Check with:
64+
```bash
65+
ls -la action.yml Dockerfile entrypoint.sh README.md
66+
```
67+
68+
## Token Permission Issues
69+
70+
### GITHUB_TOKEN Permissions
71+
72+
**Problem**: The default `GITHUB_TOKEN` doesn't have enough permissions.
73+
74+
**Solution**: The workflow now includes explicit permissions:
75+
```yaml
76+
permissions:
77+
contents: write # Create releases and tags
78+
packages: write # Docker registry access
79+
issues: write # Create issues if needed
80+
pull-requests: write # PR management
81+
```
82+
83+
### Repository Settings
84+
85+
**Problem**: Repository settings prevent Actions from creating releases.
86+
87+
**Solution**:
88+
1. Go to Settings → Actions → General
89+
2. Under "Workflow permissions" select:
90+
- "Read and write permissions"
91+
- ✅ "Allow GitHub Actions to create and approve pull requests"
92+
93+
## Docker Build Issues
94+
95+
### Docker Build Failures
96+
97+
**Problem**: The action fails to build the Docker image.
98+
99+
**Solution**: Test locally first:
100+
```bash
101+
docker build -t ssh-action-test .
102+
```
103+
104+
Common issues:
105+
- Missing `Dockerfile`
106+
- Incorrect file permissions on `entrypoint.sh`
107+
- Package installation failures
108+
109+
Fix permissions:
110+
```bash
111+
chmod +x entrypoint.sh
112+
```
113+
114+
### Alpine Package Issues
115+
116+
**Problem**: Packages fail to install in Alpine Linux.
117+
118+
**Solution**: Update package names in `Dockerfile`:
119+
```dockerfile
120+
RUN apk add --no-cache \
121+
openssh-client \
122+
sshpass \
123+
bash
124+
```
125+
126+
## Release Process Issues
127+
128+
### Tag Already Exists
129+
130+
**Problem**: Trying to create a release with an existing tag.
131+
132+
**Solution**: Delete the tag first:
133+
```bash
134+
# Delete local tag
135+
git tag -d v1.0.0
136+
137+
# Delete remote tag
138+
git push origin --delete v1.0.0
139+
140+
# Create new tag
141+
git tag -a v1.0.0 -m "Release v1.0.0"
142+
git push origin v1.0.0
143+
```
144+
145+
### Release Script Permission Denied
146+
147+
**Problem**: `./scripts/release.sh` fails with permission denied.
148+
149+
**Solution**: Make the script executable:
150+
```bash
151+
chmod +x scripts/release.sh
152+
```
153+
154+
### Git Configuration Issues
155+
156+
**Problem**: Git operations fail during release.
157+
158+
**Solution**: The workflow automatically configures Git:
159+
```bash
160+
git config user.name "GitHub Actions"
161+
git config user.email "actions@github.com"
162+
```
163+
164+
## SSH Action Usage Issues
165+
166+
### SSH Connection Failures
167+
168+
**Problem**: The action fails to connect to remote hosts.
169+
170+
**Common causes**:
171+
- Incorrect host/IP address
172+
- Wrong SSH port
173+
- Firewall blocking connections
174+
- Invalid credentials
175+
176+
**Solution**: Test SSH connection manually:
177+
```bash
178+
ssh -p 22 username@hostname
179+
```
180+
181+
### Authentication Issues
182+
183+
**Problem**: SSH authentication fails.
184+
185+
**Solution**:
186+
1. Verify credentials are correct
187+
2. Check if password authentication is enabled on the server
188+
3. Consider using SSH key authentication (future enhancement)
189+
190+
### Script Execution Failures
191+
192+
**Problem**: Scripts fail to execute on remote host.
193+
194+
**Solution**:
195+
1. Test the script locally first
196+
2. Check file permissions on remote host
197+
3. Use absolute paths in scripts
198+
4. Add proper error handling
199+
200+
## GitHub Marketplace Issues
201+
202+
### Action Not Appearing in Marketplace
203+
204+
**Problem**: Action doesn't show up in GitHub Marketplace.
205+
206+
**Solution**:
207+
1. Ensure repository is public
208+
2. Verify `action.yml` has proper branding
209+
3. Check that a release has been created
210+
4. Manually publish through repository page
211+
212+
### Marketplace Publication Fails
213+
214+
**Problem**: GitHub rejects marketplace submission.
215+
216+
**Solution**:
217+
1. Ensure action actually works
218+
2. Add comprehensive documentation
219+
3. Include usage examples
220+
4. Follow GitHub's marketplace guidelines
221+
222+
## Getting Help
223+
224+
If you encounter issues not covered here:
225+
226+
1. **Check workflow logs** in the Actions tab
227+
2. **Review the error messages** carefully
228+
3. **Test components individually** (Docker build, SSH connection, etc.)
229+
4. **Create an issue** in the repository with:
230+
- Error message
231+
- Workflow logs
232+
- Steps to reproduce
233+
234+
## Quick Fixes Checklist
235+
236+
- [ ] Repository is public
237+
- [ ] All required files exist
238+
- [ ] Scripts are executable (`chmod +x`)
239+
- [ ] Workflow permissions are set
240+
- [ ] Repository Actions settings allow write access
241+
- [ ] Docker image builds successfully
242+
- [ ] SSH credentials are valid
243+
- [ ] Release follows semantic versioning
244+
245+
Following this checklist should resolve most common issues!

0 commit comments

Comments
 (0)