Skip to content

Commit

Permalink
Merge pull request #4 from laithrafid/newprovider
Browse files Browse the repository at this point in the history
digitalocean provider support
  • Loading branch information
bluebrown authored Mar 18, 2022
2 parents 627130d + 66cde11 commit 7ecaeb9
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/digitalocean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:
branches:
- main

jobs:
use_s3cmd:
runs-on: ubuntu-latest

name: Use S3cmd for digitalocean
steps:
- name: Set up S3cmd cli tool
uses: s3-actions/s3cmd@main
with:
provider: digitalocean
region: 'NYC3'
access_key: ${{ secrets.SPACES_ACCESS_KEY_ID }}
secret_key: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}

- name: Interact with object storage
run: |
buck="github-action-${{ github.run_id }}"
mkdir example
s3cmd mb s3://$buck
echo 'foo' >> example/bar
s3cmd put example/bar s3://$buck
mkdir -p example/baz/bar
echo 'fizz' >> example/baz/bar/faz
sleep 10
s3cmd sync --recursive --acl-public example s3://$buck
sleep 10
s3cmd rm -r --force s3://$buck
sleep 10
s3cmd rb s3://$buck
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ inputs:
required: true
runs:
using: 'node12'
main: 'dist/index.js'
main: 'dist/index.js'
8 changes: 8 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@ const providers = {
access_key,
secret_key,
}),
digitalocean: ({ region = 'nyc3', access_key = '', secret_key = ''}) => ({
bucket_location: region,
host_base: `${region}.digitaloceanspaces.com`,
host_bucket: `%(bucket)s.${region}.digitaloceanspaces.com`,
website_endpoint: `http://%(bucket)s.website-${region}.digitaloceanspaces.com`,
access_key,
secret_key,
}),
linode: ({ region = 'eu-central-1', access_key = '', secret_key = '' }) => ({
bucket_location: 'US',
host_base: `${region}.linodeobjects.com`,
Expand Down
8 changes: 8 additions & 0 deletions providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ const providers = {
access_key,
secret_key,
}),
digitalocean: ({ region = 'nyc3', access_key = '', secret_key = ''}) => ({
bucket_location: region,
host_base: `${region}.digitaloceanspaces.com`,
host_bucket: `%(bucket)s.${region}.digitaloceanspaces.com`,
website_endpoint: `http://%(bucket)s.website-${region}.digitaloceanspaces.com`,
access_key,
secret_key,
}),
linode: ({ region = 'eu-central-1', access_key = '', secret_key = '' }) => ({
bucket_location: 'US',
host_base: `${region}.linodeobjects.com`,
Expand Down
9 changes: 9 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ const conf = makeConf(providers.linode({
secret_key: 'more secret'
}))

const conf2 = makeConf(providers.digitalocean({
cluster: "nyc3",
access_key: 'top-secret',
secret_key: 'more secret'
}))

const writer = createWriteStream('test')

for (const line of conf) {
writer.write(line+'\r\n')
}

for (const line of conf2) {
writer.write(line+'\r\n')
}

0 comments on commit 7ecaeb9

Please sign in to comment.