diff --git a/.github/workflows/publish-api.yml b/.github/workflows/publish-api.yml new file mode 100644 index 0000000..bf6fe59 --- /dev/null +++ b/.github/workflows/publish-api.yml @@ -0,0 +1,60 @@ +name: Publish Workers API + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - 'api/**' + +permissions: + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org/' + + - name: Create npmrc + working-directory: ./api + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_EMAIL: npm@jfrog.com + run: | + echo "Creating npmrc for publish" + cat > .npmrc << EOF + always-auth=true + email=${NPM_EMAIL} + registry=https://registry.npmjs.org/ + //registry.npmjs.org/:_authToken=${NPM_TOKEN} + EOF + cat .npmrc + echo "Creating npmrc done" + + - name: Install dependencies + working-directory: ./api + run: npm install --no-progress + + - name: Update minor version + working-directory: ./api + run: npm version minor --no-git-tag-version + + - name: Build + working-directory: ./api + run: npm run build + + - name: Publish to npm + working-directory: ./api + run: | + echo "Publishing API npm package" + npm publish + echo "Publishing API npm package done" diff --git a/api/package.json b/api/package.json index adbc5cc..f778919 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-workers", - "version": "0.9.0", + "version": "0.8.0", "description": "JFrog workers interfaces", "homepage": "https://github.com/jfrog/workers-sample", "contributors": [