Skip to content

Commit

Permalink
feat(ci): add simple publish workflow + add userAgent (#248)
Browse files Browse the repository at this point in the history
* feat(ci): add simple publish workflow + add userAgent

* fix: do the same for registry client

* fix: updated changelog entry + lock
  • Loading branch information
cyclimse authored Nov 28, 2024
1 parent eb42f5e commit 36eabec
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 24 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: "publish"

on:
release:
types: [published]

jobs:
release:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: "Set up Node"
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: "https://registry.npmjs.org"

- name: "Install dependencies"
run: npm ci

- name: "Publish package on NPM"
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.4.13

### Changed

- HTTP calls to `api.scaleway.com` are now made with a custom user agent #245

## 0.4.12

### Fixed
Expand Down
27 changes: 15 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-scaleway-functions",
"version": "0.4.12",
"version": "0.4.13",
"description": "Provider plugin for the Serverless Framework v1.x which adds support for Scaleway Functions.",
"main": "index.js",
"author": "scaleway.com",
Expand Down
3 changes: 3 additions & 0 deletions shared/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ const runtimesApi = require("./runtimes");
// Registry
const RegistryApi = require("./registry");

const version = "0.4.13";

function getApiManager(apiUrl, token) {
return axios.create({
baseURL: apiUrl,
headers: {
"User-Agent": `serverless-scaleway-functions/${version}`,
"X-Auth-Token": token,
},
httpsAgent: new https.Agent({
Expand Down
13 changes: 2 additions & 11 deletions shared/api/registry.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
"use strict";

const axios = require("axios");
const https = require("https");
const { getApiManager } = require("./index");
const { manageError } = require("./utils");

class RegistryApi {
constructor(registryApiUrl, token) {
this.apiManager = axios.create({
baseURL: registryApiUrl,
headers: {
"X-Auth-Token": token,
},
httpsAgent: new https.Agent({
rejectUnauthorized: false,
}),
});
this.apiManager = getApiManager(registryApiUrl, token);
}

listRegistryNamespace(projectId) {
Expand Down

0 comments on commit 36eabec

Please sign in to comment.