|
| 1 | +name: GHA Publish |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Version to release (e.g., 1.2.0)' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + action-name: |
| 11 | + description: 'Human readable action name (e.g., "Visual Studio VSIX Versioner")' |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + action-slug: |
| 15 | + description: 'GitHub Marketplace slug (e.g., "visual-studio-vsix-versioner")' |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + action-description: |
| 19 | + description: 'Short description for social media embeds' |
| 20 | + required: true |
| 21 | + type: string |
| 22 | + node-version-file: |
| 23 | + description: 'Path to Node version file (default: .node-version)' |
| 24 | + required: false |
| 25 | + type: string |
| 26 | + default: '.node-version' |
| 27 | + secrets: |
| 28 | + BLUESKY_USERNAME: |
| 29 | + description: 'Bluesky username' |
| 30 | + required: true |
| 31 | + BLUESKY_APP_PASSWORD: |
| 32 | + description: 'Bluesky app password' |
| 33 | + required: true |
| 34 | + LINKEDIN_ACCESS_TOKEN: |
| 35 | + description: 'LinkedIn access token' |
| 36 | + required: true |
| 37 | + LINKEDIN_CLIENT_ID: |
| 38 | + description: 'LinkedIn client ID' |
| 39 | + required: true |
| 40 | + |
| 41 | +jobs: |
| 42 | + changelog: |
| 43 | + uses: CodingWithCalvin/.github/.github/workflows/generate-changelog.yml@main |
| 44 | + secrets: inherit |
| 45 | + |
| 46 | + release: |
| 47 | + needs: changelog |
| 48 | + runs-on: ubuntu-latest |
| 49 | + outputs: |
| 50 | + version: ${{ inputs.version }} |
| 51 | + |
| 52 | + permissions: |
| 53 | + contents: write |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: Checkout |
| 57 | + uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Setup Node.js |
| 60 | + uses: actions/setup-node@v4 |
| 61 | + with: |
| 62 | + node-version-file: ${{ inputs.node-version-file }} |
| 63 | + cache: npm |
| 64 | + |
| 65 | + - name: Install Dependencies |
| 66 | + run: npm ci |
| 67 | + |
| 68 | + - name: Rebuild dist |
| 69 | + run: npm run bundle |
| 70 | + |
| 71 | + - name: Commit dist changes |
| 72 | + run: | |
| 73 | + git config user.name "github-actions[bot]" |
| 74 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 75 | + git add dist/ |
| 76 | + git diff --staged --quiet || git commit -m "chore: rebuild dist for v${{ inputs.version }}" |
| 77 | + git push |
| 78 | +
|
| 79 | + - name: Create and push tag |
| 80 | + run: | |
| 81 | + git tag v${{ inputs.version }} |
| 82 | + git push origin v${{ inputs.version }} |
| 83 | +
|
| 84 | + - name: Create GitHub Release |
| 85 | + uses: softprops/action-gh-release@v1 |
| 86 | + with: |
| 87 | + tag_name: v${{ inputs.version }} |
| 88 | + name: v${{ inputs.version }} |
| 89 | + body: ${{ needs.changelog.outputs.changelog }} |
| 90 | + |
| 91 | + notify-bluesky: |
| 92 | + needs: release |
| 93 | + uses: CodingWithCalvin/.github/.github/workflows/bluesky-post.yml@main |
| 94 | + with: |
| 95 | + post_text: | |
| 96 | + 🚀 ${{ inputs.action-name }} v${{ needs.release.outputs.version }} has been released! |
| 97 | +
|
| 98 | + ${{ inputs.action-description }} |
| 99 | +
|
| 100 | + [📋 Release Notes](https://github.com/${{ github.repository }}/releases/tag/v${{ needs.release.outputs.version }}) |
| 101 | + [📦 GitHub Marketplace](https://github.com/marketplace/actions/${{ inputs.action-slug }}) |
| 102 | +
|
| 103 | + #github #githubactions #devops #automation |
| 104 | + embed_url: https://github.com/marketplace/actions/${{ inputs.action-slug }} |
| 105 | + embed_title: ${{ inputs.action-name }} |
| 106 | + embed_description: ${{ inputs.action-description }} |
| 107 | + secrets: |
| 108 | + BLUESKY_USERNAME: ${{ secrets.BLUESKY_USERNAME }} |
| 109 | + BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }} |
| 110 | + |
| 111 | + notify-linkedin: |
| 112 | + needs: release |
| 113 | + uses: CodingWithCalvin/.github/.github/workflows/linkedin-post.yml@main |
| 114 | + with: |
| 115 | + post_text: | |
| 116 | + 🚀 ${{ inputs.action-name }} v${{ needs.release.outputs.version }} has been released! |
| 117 | +
|
| 118 | + ${{ inputs.action-description }} |
| 119 | +
|
| 120 | + 📋 Release Notes: https://github.com/${{ github.repository }}/releases/tag/v${{ needs.release.outputs.version }} |
| 121 | + 📦 GitHub Marketplace: https://github.com/marketplace/actions/${{ inputs.action-slug }} |
| 122 | +
|
| 123 | + #github #githubactions #devops #automation |
| 124 | + article_url: https://github.com/marketplace/actions/${{ inputs.action-slug }} |
| 125 | + article_title: ${{ inputs.action-name }} |
| 126 | + article_description: ${{ inputs.action-description }} |
| 127 | + secrets: |
| 128 | + LINKEDIN_ACCESS_TOKEN: ${{ secrets.LINKEDIN_ACCESS_TOKEN }} |
| 129 | + LINKEDIN_CLIENT_ID: ${{ secrets.LINKEDIN_CLIENT_ID }} |
0 commit comments