Skip to content

Commit

Permalink
feat: upload action (#10)
Browse files Browse the repository at this point in the history
* feat: upload action
* feat: file buffer and upload settings
* feat: compile and pack

Co-authored-by: Miguel Ramos <miguel.ramos@mercedes-benz.io>
  • Loading branch information
miguelramos and Miguel Ramos authored May 14, 2022
1 parent 44fe1a0 commit 6ff9a6d
Show file tree
Hide file tree
Showing 11 changed files with 26,307 additions and 357 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: ./
env:
URL: ${{ secrets.SUPA_URL }}
KEY: ${{ secrets.SUPA_KEY }}
HASH: ${{ github.sha }}
with:
milliseconds: 1000
url: "$URL"
key: "$KEY"
folder: 'dist/'
bucket: 'public'
destiny: 'supabase-action/"$HASH"'
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())
expect(true).toBeTruthy();
})
23 changes: 17 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
name: 'Your name here'
description: 'Provide a description here'
author: 'Your name or organization here'
name: 'supabase-assets'
description: 'Supabase assets uploader'
author: 'websublime.dev'
inputs:
milliseconds: # change this
url:
required: true
description: 'input description here'
default: 'default value if applicable'
description: 'Supabase client url.'
key:
required: true
description: 'Supabase client key.'
folder:
required: true
description: 'Folder path where assets are. Relative to project'
bucket:
required: true
description: 'Bucket name to where upload it.'
destiny:
required: true
description: 'Bucket folder path destiny.'
runs:
using: 'node16'
main: 'dist/index.js'
Loading

0 comments on commit 6ff9a6d

Please sign in to comment.