fix: package.json & package-lock.json to reduce vulnerabilities (#12) #7
This file contains 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
name: Main | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
get-publish-version: | |
runs-on: ubuntu-latest | |
outputs: | |
publish-version: ${{ steps.get-publish-version.outputs.publish-version }} | |
steps: | |
- name: Get publish version | |
id: get-publish-version | |
run: | | |
LATEST_VERSION=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
[ -z "$LATEST_VERSION" ] && LATEST_VERSION="0.0.0" | |
VERSION=$(echo $LATEST_VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') | |
echo "::set-output name=publish-version::${VERSION}" | |
publish-github-release: | |
runs-on: ubuntu-latest | |
needs: get-publish-version | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@master | |
- name: Set up Node.js 14 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Install dependencies | |
run: npm install | |
- name: Produce zip | |
run: zip -qq -r kong-portal-cli-lambda-${{ needs.get-publish-version.outputs.publish-version }}.zip node_modules *.js | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.get-publish-version.outputs.publish-version }} | |
release_name: Release ${{ needs.get-publish-version.outputs.publish-version }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: kong-portal-cli-lambda-${{ needs.get-publish-version.outputs.publish-version }}.zip | |
asset_name: kong-portal-cli-lambda-${{ needs.get-publish-version.outputs.publish-version }}.zip | |
asset_content_type: application/zip |