Skip to content

Commit 55c0021

Browse files
committed
Refactor to javascript
1 parent e252488 commit 55c0021

File tree

7 files changed

+66
-91
lines changed

7 files changed

+66
-91
lines changed

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
FROM mcr.microsoft.com/azure-cli
22

3+
LABEL "com.github.actions.name"="Create Azure Machine Learning Workspace Endpoint"
4+
LABEL "com.github.actions.description"="Create an Azure Machine Learning Workspace Endpoint"
5+
LABEL "com.github.actions.icon"="box"
6+
LABEL "com.github.actions.color"="green"
7+
LABEL "repository"="https://github.com/coding-kitties/create-aml-online-endpoint"
8+
LABEL "homepage"="https://github.com/coding-kitties/create-aml-online-endpoint"
9+
LABEL "maintainer"="Marc van Duyn <marcvanduyn@microsoft.com>"
10+
311
# Install jq (for parsing JSON)
412
RUN apt-get update && apt-get install -y jq
513

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This GitHub Action creates an **Azure Machine Learning Online Endpoint**.
44

5+
## Dependencies on other Github Actions
6+
7+
* Authenticate using [Azure Login](https://github.com/Azure/login)
8+
59
## 🚀 Usage
610

711
### **1. Add to Your Workflow**
@@ -11,13 +15,14 @@ jobs:
1115
deploy:
1216
runs-on: ubuntu-latest
1317
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v4
18+
- uses: actions/checkout@v2.3.2
19+
- uses: Azure/login@v1
20+
with:
21+
creds: ${{secrets.AZURE_CREDENTIALS}}
1622

1723
- name: Create AML Online Endpoint
18-
uses: coding-kitties/create-aml-online-endpoint@v1
24+
uses: coding-kitties/create-aml-online-endpoint@v0.2.0
1925
with:
20-
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
2126
endpoint_name: 'my-endpoint'
2227
resource_group: 'my-resource-group'
2328
workspace_name: 'my-workspace'

action.yaml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ name: 'Create Azure ML Online Endpoint'
22
description: 'Create an Azure ML Online Endpoint'
33
author: 'Marc van Duyn'
44
branding:
5-
icon: 'cloud'
6-
color: 'blue'
5+
icon: 'azure-logo.svg'
6+
color: 'blue'
77

88
inputs:
9-
azure_credentials:
10-
description: 'Azure credentials in JSON format (Service Principal)'
11-
required: true
129
endpointName:
1310
description: 'Name of the endpoint'
1411
required: true
@@ -20,20 +17,5 @@ inputs:
2017
required: true
2118

2219
runs:
23-
using: 'composite'
24-
steps:
25-
# Step 1: Log into Azure using Azure Login action
26-
- name: Log into Azure
27-
uses: azure/login@v1
28-
with:
29-
creds: ${{ secrets.AZURE_CREDENTIALS }}
30-
31-
# Step 2: Checkout repository
32-
- name: Checkout repository
33-
uses: actions/checkout@v4
34-
35-
# Step 3: Set up Docker (if needed) and run the entrypoint script
36-
- name: Run Docker container with entrypoint.sh
37-
run: |
38-
docker build -t aml-deploy .
39-
docker run -v $PWD:/workspace -e AZURE_CREDENTIALS="${{ secrets.AZURE_CREDENTIALS }}" aml-deploy /workspace/entrypoint.sh "${{ inputs.azure_credentials }}" "${{ inputs.endpointName }}" "${{ inputs.workspace_name }}" "${{ inputs.resource_group }}"
20+
using: "node16"
21+
main: "dist/index.js"

azure-logo.svg

Lines changed: 1 addition & 0 deletions
Loading

entrypoint.sh

Lines changed: 0 additions & 65 deletions
This file was deleted.

index.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const core = require("@actions/core");
2+
const exec = require("@actions/exec");
3+
4+
async function run() {
5+
try {
6+
const endpointName = core.getInput("endpoint_name");
7+
const resourceGroup = core.getInput("resource_group");
8+
const workspaceName = core.getInput("workspace_name");
9+
10+
// Check if the required inputs are provided
11+
if (!endpointName) {
12+
throw new Error("Endpoint name is required.");
13+
}
14+
15+
if (!resourceGroup) {
16+
throw new Error("Resource group is required");
17+
}
18+
19+
if (!workspaceName) {
20+
throw new Error("Workspace name is required");
21+
}
22+
23+
console.log(`🔹 Deploying AML Endpoint: ${endpointName}`);
24+
25+
// Run Azure CLI command
26+
await exec.exec(`az ml online-endpoint create --name ${endpointName} --resource-group ${resourceGroup} --workspace-name ${workspaceName}`);
27+
28+
console.log(`✅ Successfully deployed: ${endpointName}`);
29+
} catch (error) {
30+
core.setFailed(`❌ Action failed: ${error.message}`);
31+
}
32+
}
33+
34+
run();

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "create-aml-online-endpoint",
3+
"version": "1.0.0",
4+
"description": "GitHub Action to create an Azure ML Online Endpoint",
5+
"main": "index.js",
6+
"dependencies": {
7+
"@actions/core": "^1.10.0",
8+
"@actions/exec": "^1.1.1"
9+
}
10+
}

0 commit comments

Comments
 (0)