chore: remove references to Snyk (#851) #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| --- | |
| name: Release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| permissions: write-all | |
| runs-on: ubuntu-latest | |
| if: "github.repository_owner == 'fabric8-analytics' && startsWith(github.event.head_commit.message, '[release]')" | |
| name: Create & publish a release | |
| environment: production | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ssh-key: ${{ secrets.DEPLOY_KEY }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: 'https://npm.pkg.github.com' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create .npmrc | |
| run: | | |
| echo "@trustification:registry=https://npm.pkg.github.com" > ~/.npmrc | |
| echo "@fabric8-analytics:registry=https://npm.pkg.github.com" >> ~/.npmrc | |
| - name: Install @vscode/vsce | |
| run: npm i -g @vscode/vsce | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Read new version from package.json | |
| id: release_version | |
| run: | | |
| new_version=$(node -p "require('./package.json').version") | |
| echo "version=v$new_version" >> "$GITHUB_OUTPUT" | |
| - name: VSCE package | |
| run: vsce package --out fabric8-analytics-${{ steps.release_version.outputs.version }}-${{ github.run_number }}.vsix | |
| - name: Create SHA256 checksum | |
| run: | | |
| sha256sum fabric8-analytics-${{ steps.release_version.outputs.version }}-${{ github.run_number }}.vsix > fabric8-analytics-${{ steps.release_version.outputs.version }}-${{ github.run_number }}.vsix.sha256 | |
| - name: Create a release | |
| id: new_release | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const repo_name = context.payload.repository.full_name | |
| const response = await github.request('POST /repos/' + repo_name + '/releases', { | |
| tag_name: '${{ steps.release_version.outputs.version }}', | |
| name: '${{ steps.release_version.outputs.version }}', | |
| body: '${{ steps.release-notes.outputs.notes }}', | |
| prerelease: false, | |
| generate_release_notes: true | |
| }) | |
| core.setOutput('upload_url', response.data.upload_url) | |
| - name: Upload packages and checksums as release assets | |
| run: | | |
| for file in fabric8-analytics-${{ steps.release_version.outputs.version }}-${{ github.run_number }}.vsix* | |
| do | |
| asset_name=$(basename "$file") | |
| upload_url=$(echo "${{ steps.new_release.outputs.upload_url }}" | sed "s/{?name,label}/?name=$asset_name/g") | |
| curl --data-binary @"$file" \ | |
| -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "Content-Type: application/octet-stream" \ | |
| "$upload_url" | |
| done | |
| - name: Publish to VSCode Marketplace | |
| run: | | |
| vsce publish --pat ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath fabric8-analytics-${{ steps.release_version.outputs.version }}-${{ github.run_number }}.vsix | |
| - name: Publish to Open VSX Registry | |
| run: | | |
| npx ovsx publish --pat ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath fabric8-analytics-${{ steps.release_version.outputs.version }}-${{ github.run_number }}.vsix | |