|
| 1 | +name: Publisher CVEs Extension |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +# Setup the environment with the extension name for easy re-use |
| 7 | +# Also need the GH_TOKEN for the release-extension action to be able to use gh |
| 8 | +env: |
| 9 | + EXTENSION_NAME: publisher-cves |
| 10 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 11 | + |
| 12 | +jobs: |
| 13 | + extension: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + defaults: |
| 16 | + run: |
| 17 | + working-directory: ./extensions/${{ env.EXTENSION_NAME }} |
| 18 | + |
| 19 | + steps: |
| 20 | + # Checkout the repository so the rest of the actions can run with no issue |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + # We want to fail quickly if the linting fails, do that first |
| 24 | + - uses: ./.github/actions/lint-extension |
| 25 | + with: |
| 26 | + extension-name: ${{ env.EXTENSION_NAME }} |
| 27 | + |
| 28 | + # Publisher Command Center needs to setup node, install dependencies, and |
| 29 | + # build to make the files needed for the extension |
| 30 | + - uses: actions/setup-node@v4 |
| 31 | + with: |
| 32 | + node-version: "lts/*" |
| 33 | + cache: "npm" |
| 34 | + cache-dependency-path: extensions/${{ env.EXTENSION_NAME }}/package-lock.json |
| 35 | + |
| 36 | + - run: npm ci |
| 37 | + - run: npm run build |
| 38 | + |
| 39 | + # Now that the extension is built we need to upload an artifact to pass |
| 40 | + # to the package-extension action that contains the files we want to be |
| 41 | + # included in the extension |
| 42 | + # This only includes necessary files for the extension to run leaving out |
| 43 | + # the files that were used to build the /dist/ directory |
| 44 | + - name: Upload built extension |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: ${{ env.EXTENSION_NAME }} |
| 48 | + path: | |
| 49 | + extensions/${{ env.EXTENSION_NAME }}/dist/ |
| 50 | + extensions/${{ env.EXTENSION_NAME }}/requirements.txt |
| 51 | + extensions/${{ env.EXTENSION_NAME }}/main.py |
| 52 | + extensions/${{ env.EXTENSION_NAME }}/manifest.json |
| 53 | +
|
| 54 | + # Package up the extension into a TAR using the generalized |
| 55 | + # package-extension action |
| 56 | + - uses: ./.github/actions/package-extension |
| 57 | + with: |
| 58 | + extension-name: ${{ env.EXTENSION_NAME }} |
| 59 | + artifact-name: ${{ env.EXTENSION_NAME }} |
| 60 | + |
| 61 | + connect-integration-tests: |
| 62 | + needs: extension |
| 63 | + uses: ./.github/workflows/connect-integration-tests.yml |
| 64 | + secrets: inherit |
| 65 | + with: |
| 66 | + extensions: '["publisher-cves"]' # JSON array format to match the workflow input schema |
| 67 | + |
| 68 | + release: |
| 69 | + runs-on: ubuntu-latest |
| 70 | + needs: [extension, connect-integration-tests] |
| 71 | + # Release the extension using the release-extension action |
| 72 | + # Will only create a GitHub release if merged to `main` and the semver |
| 73 | + # version has been updated |
| 74 | + steps: |
| 75 | + # Checkout the repository so the rest of the actions can run with no issue |
| 76 | + - uses: actions/checkout@v4 |
| 77 | + |
| 78 | + - uses: ./.github/actions/release-extension |
| 79 | + with: |
| 80 | + extension-name: ${{ env.EXTENSION_NAME }} |
0 commit comments