Skip to content

Commit b5ae7ba

Browse files
committed
feature: meshstack auth
0 parents  commit b5ae7ba

File tree

12 files changed

+68107
-0
lines changed

12 files changed

+68107
-0
lines changed

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- 'v*.*.*'
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v2
17+
with:
18+
node-version: '20'
19+
20+
- name: Install dependencies
21+
run: npm install
22+
23+
- name: Compile TypeScript
24+
run: npx tsc
25+
26+
- name: Bundle with ncc
27+
run: |
28+
npm run build
29+
30+
- name: Get release ID
31+
id: get_release
32+
uses: actions/github-script@v4
33+
with:
34+
script: |
35+
const release = await github.repos.getReleaseByTag({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
tag: context.ref.replace('refs/tags/', '')
39+
});
40+
return release.data.id;
41+
result-encoding: string
42+
43+
- name: Upload release asset
44+
uses: actions/upload-release-asset@v1
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
with:
48+
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.get_release.outputs.result }}/assets?name=index.js
49+
asset_path: ./dist/index.js
50+
asset_name: index.js
51+
asset_content_type: application/javascript
52+

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Test Action
2+
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout repository
8+
uses: actions/checkout@v2
9+
10+
- name: Setup Meshstack Authentication
11+
id: setup-meshstack-auth
12+
uses: ./
13+
with:
14+
base_url: https://federation.dev.meshcloud.io
15+
client_id: ${{ secrets.CLIENT_ID }}
16+
key_secret: ${{ secrets.KEY_SECRET }}

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Node.js
2+
node_modules/
3+
build/
4+
5+
# TypeScript
6+
*.tsbuildinfo
7+
8+
# Logs
9+
logs
10+
*.log
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
15+
# Dependency directories
16+
jspm_packages/
17+
18+
# Optional npm cache directory
19+
.npm
20+
21+
# Optional eslint cache
22+
.eslintcache
23+
24+
# Optional REPL history
25+
.node_repl_history
26+
27+
# Output of 'npm pack'
28+
*.tgz
29+
30+
# Yarn Integrity file
31+
.yarn-integrity
32+
33+
# dotenv environment variables file
34+
.env
35+
36+
# MacOS files
37+
.DS_Store
38+
39+
# Editor directories and files
40+
.vscode/
41+
.idea/
42+
*.suo
43+
*.ntvs*
44+
*.njsproj
45+
*.sln
46+
*.sw?
47+
48+
#testing secret
49+
.secrets

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# MeshStack Auth Action
2+
3+
This action authenticates to meshStack API.
4+
5+
### Overview
6+
7+
This GitHub Action is designed to authenticate against the Meshfed API. It helps you obtain an access token using client credentials, which can then be used to interact with the Meshfed API securely. This action simplifies the process of obtaining and managing authentication tokens for your workflows.
8+
9+
### API Documentation
10+
11+
For more information about the Meshfed API, please refer to the [Meshfed API Documentation](https://docs.meshcloud.io/api/index.html).
12+
13+
14+
### Inputs
15+
16+
- `base_url` (required): meshStack API endpoint.
17+
- `client_id` (required): The client ID for the API.
18+
- `key_secret` (required): The key secret for the API.
19+
20+
### Outputs
21+
22+
- `token_file`: Path to the file containing the authentication token
23+
24+
25+
### Example Usage
26+
27+
```yaml
28+
- name: Setup meshStack bbrun
29+
id: setup-meshstack-auth
30+
uses: meshcloud/actions-register-source@main
31+
with:
32+
base_url: ${{ vars.BUILDINGBLOCK_API_BASE_URL }}
33+
client_id: ${{ vars.BUILDINGBLOCK_API_CLIENT_ID }}
34+
key_secret: ${{ secrets.BUILDINGBLOCK_API_KEY_SECRET }}
35+
```

action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Setup Meshstack Authentication'
2+
description: 'Authenticates with Meshstack and sets up environment variables'
3+
inputs:
4+
base_url:
5+
description: 'The URL of the Meshstack instance'
6+
required: true
7+
type: string
8+
client_id:
9+
description: 'The client ID for authentication'
10+
required: true
11+
type: string
12+
key_secret:
13+
description: 'The key secret for authentication'
14+
required: true
15+
type: string
16+
outputs:
17+
token_file:
18+
description: 'Path to the file containing the authentication token'
19+
runs:
20+
using: 'node20'
21+
main: 'dist/main/index.js'
22+
post: 'dist/cleanup/index.js'
23+
24+

0 commit comments

Comments
 (0)