|
| 1 | +name: Package and Upload Release Assets |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created] |
| 6 | + |
| 7 | + # This allows you to run the workflow manually from the Actions tab |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + tag_name: |
| 11 | + description: 'The tag of the release to upload assets to' |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + |
| 15 | +permissions: |
| 16 | + # This permission is required for the action to create a GitHub Release |
| 17 | + contents: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + build-and-package: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + # 1. Checks out your repository's code |
| 24 | + - name: Checkout code |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + # 2. Sets up the Node.js environment |
| 28 | + - name: Setup Node.js |
| 29 | + uses: actions/setup-node@v4 |
| 30 | + with: |
| 31 | + node-version: '20' # Specify the Node.js version you use |
| 32 | + cache: 'npm' |
| 33 | + # Tell the cache where to find the package-lock.json |
| 34 | + cache-dependency-path: mcp-server/package-lock.json |
| 35 | + |
| 36 | + # 3. Install MCP server dependencies |
| 37 | + # The MCP server needs its dependencies bundled in the release |
| 38 | + - name: Install MCP server dependencies |
| 39 | + run: cd mcp-server && npm ci |
| 40 | + |
| 41 | + # 4. Runs your build script |
| 42 | + - name: Run build |
| 43 | + run: cd mcp-server && npm run build |
| 44 | + |
| 45 | + # 5. Create TAR archive with MCP server dependencies |
| 46 | + # Exclude root node_modules but INCLUDE mcp-server/node_modules |
| 47 | + - name: Create TAR archive |
| 48 | + run: tar -cvzf ../security-release.tar.gz --exclude='.git' --exclude='.github' --exclude='./assets' . && mv ../security-release.tar.gz . |
| 49 | + |
| 50 | + # 6. Upload the TAR archive as a release asset |
| 51 | + - name: Upload archive to GitHub Release |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + run: | |
| 55 | + gh release upload \ |
| 56 | + ${{ github.event.release.tag_name || inputs.tag_name }} \ |
| 57 | + security-release.tar.gz |
0 commit comments