Skip to content

Commit

Permalink
feature: meshstack auth
Browse files Browse the repository at this point in the history
  • Loading branch information
florianow committed Nov 8, 2024
0 parents commit b5ae7ba
Show file tree
Hide file tree
Showing 12 changed files with 68,107 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release
on:
push:
tags:
- 'v*.*.*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Compile TypeScript
run: npx tsc

- name: Bundle with ncc
run: |
npm run build
- name: Get release ID
id: get_release
uses: actions/github-script@v4
with:
script: |
const release = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: context.ref.replace('refs/tags/', '')
});
return release.data.id;
result-encoding: string

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.get_release.outputs.result }}/assets?name=index.js
asset_path: ./dist/index.js
asset_name: index.js
asset_content_type: application/javascript

16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Test Action

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Meshstack Authentication
id: setup-meshstack-auth
uses: ./
with:
base_url: https://federation.dev.meshcloud.io
client_id: ${{ secrets.CLIENT_ID }}
key_secret: ${{ secrets.KEY_SECRET }}
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Node.js
node_modules/
build/

# TypeScript
*.tsbuildinfo

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Dependency directories
jspm_packages/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# MacOS files
.DS_Store

# Editor directories and files
.vscode/
.idea/
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

#testing secret
.secrets
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# MeshStack Auth Action

This action authenticates to meshStack API.

### Overview

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.

### API Documentation

For more information about the Meshfed API, please refer to the [Meshfed API Documentation](https://docs.meshcloud.io/api/index.html).


### Inputs

- `base_url` (required): meshStack API endpoint.
- `client_id` (required): The client ID for the API.
- `key_secret` (required): The key secret for the API.

### Outputs

- `token_file`: Path to the file containing the authentication token


### Example Usage

```yaml
- name: Setup meshStack bbrun
id: setup-meshstack-auth
uses: meshcloud/actions-register-source@main
with:
base_url: ${{ vars.BUILDINGBLOCK_API_BASE_URL }}
client_id: ${{ vars.BUILDINGBLOCK_API_CLIENT_ID }}
key_secret: ${{ secrets.BUILDINGBLOCK_API_KEY_SECRET }}
```
24 changes: 24 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Setup Meshstack Authentication'
description: 'Authenticates with Meshstack and sets up environment variables'
inputs:
base_url:
description: 'The URL of the Meshstack instance'
required: true
type: string
client_id:
description: 'The client ID for authentication'
required: true
type: string
key_secret:
description: 'The key secret for authentication'
required: true
type: string
outputs:
token_file:
description: 'Path to the file containing the authentication token'
runs:
using: 'node20'
main: 'dist/main/index.js'
post: 'dist/cleanup/index.js'


Loading

0 comments on commit b5ae7ba

Please sign in to comment.