A customized proxy builder to build and publish upm package using Azure Pipelines
.
Prepare a service connection
- Visit https://dev.azure.com/openupm/openupm
- Project settings > Service connections > New service connection > npm
- Connection name,
openupm
- Registry URL,
https://package.openupm.com
- Personal Token...
Required variables
{
repo_url: 'https://...',
repo_branch: 'master',
package_name: 'com.yourcompany.package...'
}
If no variables are provided, the build will be abort as failed.
Api reference: azure-devops-rest-5.1.
http --ignore-stdin \
-v \
-a username:token \
post https://dev.azure.com/openupm/openupm/_apis/build/builds?api-version=5.1 \
definition:='{ "id": 1 }' \
parameters:='"{ \"repo_url\": \"https://...\", ... }"'
The parameters
argument is a stringified dictionary.
https://github.com/Microsoft/azure-devops-node-api
const azureDevops = require("azure-devops-node-api");
const token = '';
const endpoint = 'https://dev.azure.com/openupm';
const definitionId = 1;
const project = 'openupm';
const buildPipelines = async function () {
let authHandler = azureDevops.getPersonalAccessTokenHandler(token);
let conn = new azureDevops.WebApi(endpoint, authHandler);
var buildApi = await conn.getBuildApi();
let build = await buildApi.queueBuild({
definition: {
id: definitionId
},
parameters:
JSON.stringify(
{
repo_url: 'https://...',
...
}
)
}, project);
cconsole.log(build);
};
Favo Yang 💻 🚧 |
Pavel "am1goo" Shestakov 💻 |
James Frowen 🐛 |