Skip to content

Commit 7ecaeb9

Browse files
authored
Merge pull request #4 from laithrafid/newprovider
digitalocean provider support
2 parents 627130d + 66cde11 commit 7ecaeb9

File tree

5 files changed

+60
-1
lines changed

5 files changed

+60
-1
lines changed

.github/workflows/digitalocean.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
jobs:
7+
use_s3cmd:
8+
runs-on: ubuntu-latest
9+
10+
name: Use S3cmd for digitalocean
11+
steps:
12+
- name: Set up S3cmd cli tool
13+
uses: s3-actions/s3cmd@main
14+
with:
15+
provider: digitalocean
16+
region: 'NYC3'
17+
access_key: ${{ secrets.SPACES_ACCESS_KEY_ID }}
18+
secret_key: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}
19+
20+
- name: Interact with object storage
21+
run: |
22+
buck="github-action-${{ github.run_id }}"
23+
mkdir example
24+
s3cmd mb s3://$buck
25+
echo 'foo' >> example/bar
26+
s3cmd put example/bar s3://$buck
27+
mkdir -p example/baz/bar
28+
echo 'fizz' >> example/baz/bar/faz
29+
sleep 10
30+
s3cmd sync --recursive --acl-public example s3://$buck
31+
sleep 10
32+
s3cmd rm -r --force s3://$buck
33+
sleep 10
34+
s3cmd rb s3://$buck

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ inputs:
1717
required: true
1818
runs:
1919
using: 'node12'
20-
main: 'dist/index.js'
20+
main: 'dist/index.js'

dist/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,14 @@ const providers = {
445445
access_key,
446446
secret_key,
447447
}),
448+
digitalocean: ({ region = 'nyc3', access_key = '', secret_key = ''}) => ({
449+
bucket_location: region,
450+
host_base: `${region}.digitaloceanspaces.com`,
451+
host_bucket: `%(bucket)s.${region}.digitaloceanspaces.com`,
452+
website_endpoint: `http://%(bucket)s.website-${region}.digitaloceanspaces.com`,
453+
access_key,
454+
secret_key,
455+
}),
448456
linode: ({ region = 'eu-central-1', access_key = '', secret_key = '' }) => ({
449457
bucket_location: 'US',
450458
host_base: `${region}.linodeobjects.com`,

providers.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ const providers = {
99
access_key,
1010
secret_key,
1111
}),
12+
digitalocean: ({ region = 'nyc3', access_key = '', secret_key = ''}) => ({
13+
bucket_location: region,
14+
host_base: `${region}.digitaloceanspaces.com`,
15+
host_bucket: `%(bucket)s.${region}.digitaloceanspaces.com`,
16+
website_endpoint: `http://%(bucket)s.website-${region}.digitaloceanspaces.com`,
17+
access_key,
18+
secret_key,
19+
}),
1220
linode: ({ region = 'eu-central-1', access_key = '', secret_key = '' }) => ({
1321
bucket_location: 'US',
1422
host_base: `${region}.linodeobjects.com`,

test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,18 @@ const conf = makeConf(providers.linode({
77
secret_key: 'more secret'
88
}))
99

10+
const conf2 = makeConf(providers.digitalocean({
11+
cluster: "nyc3",
12+
access_key: 'top-secret',
13+
secret_key: 'more secret'
14+
}))
15+
1016
const writer = createWriteStream('test')
1117

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

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

0 commit comments

Comments
 (0)