Skip to content

Commit

Permalink
Initial action work (#10)
Browse files Browse the repository at this point in the history
* first pass

* add manual deployment workflow

* build
  • Loading branch information
kylebjordahl authored Jan 26, 2023
1 parent e4be60b commit d9d4b25
Show file tree
Hide file tree
Showing 11 changed files with 15,142 additions and 248 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/manual-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy to Env

on:
workflow_dispatch:
inputs:

release_tag:
description: the tag of the release to deploy
type: string
default: latestRelease
required: true

environment:
description: the environment to deploy to
type: choice
options:
- production-ohm
- beta-ohm
required: true


jobs:
do_deploy:
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
- run: echo "Do deployment of ${{inputs.release_tag}} to ${{ inputs.environment }}"

- uses: ./
with:
ref: ${{inputs.release_tag}}
description: Deployment of ${{inputs.release_tag}} to ${{ inputs.environment }}
environment: ${{ inputs.environment }}
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"trailingComma": "all",
"bracketSpacing": false,
"arrowParens": "avoid"
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"prettier.requireConfig": true
}
25 changes: 1 addition & 24 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
import {wait} from '../src/wait'
import * as process from 'process'
import * as cp from 'child_process'
import * as path from 'path'
import {expect, test} from '@jest/globals'

test('throws invalid number', async () => {
const input = parseInt('foo', 10)
await expect(wait(input)).rejects.toThrow('milliseconds not a number')
})

test('wait 500 ms', async () => {
const start = new Date()
await wait(500)
const end = new Date()
var delta = Math.abs(end.getTime() - start.getTime())
expect(delta).toBeGreaterThan(450)
})

// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
process.env['INPUT_MILLISECONDS'] = '500'
const np = process.execPath
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecFileSyncOptions = {
env: process.env
}
console.log(cp.execFileSync(np, [ip], options).toString())
})
test.skip('TODO', async () => {})
17 changes: 11 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: 'Your name here'
description: 'Provide a description here'
author: 'Your name or organization here'
name: 'Replace Workflow Deployment'
description: 'Replace a deployment created by the current workflow with a new one.'
author: 'kylebjordahl'
inputs:
milliseconds: # change this
environment: # change this
required: true
description: 'input description here'
default: 'default value if applicable'
description: 'The environment for the deployment'
ref: # change this
required: true
description: 'The ref to link the deployment to'
description:
required: true
description: 'The description to display on the deployment (limited to 140 characters)'
runs:
using: 'node16'
main: 'dist/index.js'
Loading

0 comments on commit d9d4b25

Please sign in to comment.