Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): add simple publish workflow + add userAgent #248

Merged
merged 3 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
cyclimse marked this conversation as resolved.
Show resolved Hide resolved

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
cyclimse marked this conversation as resolved.
Show resolved Hide resolved
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 }}
cyclimse marked this conversation as resolved.
Show resolved Hide resolved
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";
cyclimse marked this conversation as resolved.
Show resolved Hide resolved

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
Loading