|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - 'scripts/claude-docs-helper.sh.template' |
| 9 | + workflow_dispatch: # Allow manual trigger |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + release: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 # Get all history for changelog |
| 23 | + |
| 24 | + - name: Extract version from helper script |
| 25 | + id: version |
| 26 | + run: | |
| 27 | + VERSION=$(grep "^SCRIPT_VERSION=" scripts/claude-docs-helper.sh.template | cut -d'"' -f2) |
| 28 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 29 | + echo "tag=v$VERSION" >> $GITHUB_OUTPUT |
| 30 | + echo "Extracted version: $VERSION" |
| 31 | +
|
| 32 | + - name: Check if release exists |
| 33 | + id: check_release |
| 34 | + run: | |
| 35 | + if gh release view "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then |
| 36 | + echo "exists=true" >> $GITHUB_OUTPUT |
| 37 | + echo "Release ${{ steps.version.outputs.tag }} already exists" |
| 38 | + else |
| 39 | + echo "exists=false" >> $GITHUB_OUTPUT |
| 40 | + echo "Release ${{ steps.version.outputs.tag }} does not exist" |
| 41 | + fi |
| 42 | + env: |
| 43 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + |
| 45 | + - name: Create release |
| 46 | + if: steps.check_release.outputs.exists == 'false' |
| 47 | + run: | |
| 48 | + gh release create "${{ steps.version.outputs.tag }}" \ |
| 49 | + --title "Claude Code Docs ${{ steps.version.outputs.tag }}" \ |
| 50 | + --generate-notes \ |
| 51 | + --notes " |
| 52 | + ## Claude Code Documentation Mirror ${{ steps.version.outputs.tag }} |
| 53 | +
|
| 54 | + This release includes the latest updates to the Claude Code documentation mirror. |
| 55 | +
|
| 56 | + ### Installation |
| 57 | +
|
| 58 | + \`\`\`bash |
| 59 | + curl -fsSL https://raw.githubusercontent.com/ericbuess/claude-code-docs/main/install.sh | bash |
| 60 | + \`\`\` |
| 61 | +
|
| 62 | + ### What's Changed (Auto-generated) |
| 63 | + " |
| 64 | + env: |
| 65 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + |
| 67 | + - name: Release already exists |
| 68 | + if: steps.check_release.outputs.exists == 'true' |
| 69 | + run: | |
| 70 | + echo "ℹ️ Release ${{ steps.version.outputs.tag }} already exists, skipping creation" |
0 commit comments