Skip to content

Commit 16c260e

Browse files
committed
Initial commit
0 parents  commit 16c260e

File tree

19 files changed

+135666
-0
lines changed

19 files changed

+135666
-0
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for npm
4+
- package-ecosystem: 'npm'
5+
# Look for `package.json` and `lock` files in the `root` directory
6+
directory: '/'
7+
# Check the npm registry for updates every day (weekdays)
8+
schedule:
9+
interval: 'daily'

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Continuous Integration workflow to:
2+
# 1. Build, lint, and test project
3+
# 2. Commit any updates to "dist" folder
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
11+
name: Continuous Integration
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- uses: actions/setup-node@v2
21+
with:
22+
node-version: '12'
23+
24+
- run: npm install
25+
26+
- run: npm run build
27+
28+
- run: npm run lint
29+
30+
- run: npm run test
31+
32+
- name: Examine changes
33+
run: |-
34+
echo 'FILES_CHANGED<<EOF' >> $GITHUB_ENV
35+
git diff --exit-code dist/index.js >> $GITHUB_ENV
36+
echo 'EOF' >> $GITHUB_ENV
37+
38+
- name: Update dist
39+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && env.FILES_CHANGED }}
40+
uses: swinton/[email protected]
41+
env:
42+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
files:
45+
dist/index.js
46+
commit-message: Update dist

.github/workflows/publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Publish workflow to automate semantic tagging after manual release
2+
# Read more here: https://docs.github.com/en/actions/creating-actions/about-actions#using-release-management-for-actions
3+
4+
name: Publish
5+
6+
on:
7+
release:
8+
types: [published, edited]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
ref: ${{ github.event.release.tag_name }}
18+
19+
- uses: JasonEtco/build-and-tag-action@v2
20+
env:
21+
GITHUB_TOKEN: ${{ github.token }}

.gitignore

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Dependency directory
2+
node_modules
3+
4+
# nektos/act
5+
.secrets
6+
7+
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
8+
# Logs
9+
logs
10+
*.log
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
lerna-debug.log*
15+
16+
# Diagnostic reports (https://nodejs.org/api/report.html)
17+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
18+
19+
# Runtime data
20+
pids
21+
*.pid
22+
*.seed
23+
*.pid.lock
24+
25+
# Directory for instrumented libs generated by jscoverage/JSCover
26+
lib-cov
27+
28+
# Coverage directory used by tools like istanbul
29+
coverage
30+
*.lcov
31+
32+
# nyc test coverage
33+
.nyc_output
34+
35+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
36+
.grunt
37+
38+
# Bower dependency directory (https://bower.io/)
39+
bower_components
40+
41+
# node-waf configuration
42+
.lock-wscript
43+
44+
# Compiled binary addons (https://nodejs.org/api/addons.html)
45+
build/Release
46+
47+
# Dependency directories
48+
jspm_packages/
49+
50+
# TypeScript v1 declaration files
51+
typings/
52+
53+
# TypeScript cache
54+
*.tsbuildinfo
55+
56+
# Optional npm cache directory
57+
.npm
58+
59+
# Optional eslint cache
60+
.eslintcache
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# next.js build output
79+
.next
80+
81+
# nuxt.js build output
82+
.nuxt
83+
84+
# vuepress build output
85+
.vuepress/dist
86+
87+
# Serverless directories
88+
.serverless/
89+
90+
# FuseBox cache
91+
.fusebox/
92+
93+
# DynamoDB Local files
94+
.dynamodb/
95+
96+
# OS metadata
97+
.DS_Store
98+
Thumbs.db
99+
100+
# Ignore built ts files
101+
__tests__/runner/*
102+
lib/**/*

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to make participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all project spaces, and it also applies when
49+
an individual is representing the project or its community in public spaces.
50+
Examples of representing a project or community include using an official
51+
project e-mail address, posting via an official social media account, or acting
52+
as an appointed representative at an online or offline event. Representation of
53+
a project may be further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Contributing
2+
3+
[fork]: https://github.com/github-developer/upload-azure-blob/fork
4+
[pr]: https://github.com/github-developer/upload-azure-blob/compare
5+
[code-of-conduct]: CODE_OF_CONDUCT.md
6+
7+
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
8+
9+
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
10+
11+
Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.
12+
13+
## Submitting a pull request
14+
15+
0. [Fork][fork] and clone the repository
16+
0. Follow the [development guidance in the README](../README.md#Development)
17+
0. Make your change, add tests, and make sure the tests still pass
18+
0. Ensure the linter is run and passes
19+
0. Push to your fork and [submit a pull request][pr]
20+
0. Pat your self on the back and wait for your pull request to be reviewed and merged
21+
22+
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
23+
24+
- Write tests.
25+
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
26+
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
27+
28+
## Resources
29+
30+
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
31+
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
32+
- [GitHub Help](https://help.github.com)

LICENSE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2021 GitHub, Inc.
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<p align="center">
2+
<a href="https://github.com/github-developer/upload-azure-blob/actions"><img alt="typescript-action status" src="https://github.com/github-developer/upload-azure-blob/workflows/build-test/badge.svg"></a>
3+
</p>
4+
5+
# Upload Blob to Azure Storage
6+
7+
This is an _example_ GitHub action built in TypeScript that uploads file(s) to [Azure Blob Storage](https://azure.microsoft.com/en-us/services/storage/blobs/), a "massively scalable and secure object storage for cloud-native workloads, archives, data lakes, high-performance computing, and machine learning".
8+
9+
Note: this action is meant solely for demonstration purposes. Best viewed together with the accompanying [blog post](TODO).
10+
11+
For more about GitHub Actions, refer to [the documentation](https://docs.github.com/en/actions/creating-actions).
12+
13+
## Pre-reqs
14+
15+
- Use an existing Azure account or [sign up](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) for a free account
16+
- Make sure you have access to a new or existing resource group, storage account, and container – for example, by following the first few steps of [this quickstart](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-cli)
17+
- Then, [configure credentials](https://github.com/Azure/login#configure-deployment-credentials) that can write Azure Storage containers and blobs, like a service principal with the ["Storage Blob Data Contributor"](https://docs.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#storage-blob-data-contributor) role.
18+
```
19+
az ad sp create-for-rbac
20+
--name $SP_NAME
21+
--sdk-auth
22+
--role "Storage Blob Data Contributor"
23+
--scopes /subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP_NAME
24+
```
25+
- Finally, store these credentials as a secret named `AZURE_CREDENTIALS`
26+
27+
## Usage
28+
29+
Simple example:
30+
31+
```yml
32+
# GitHub Actions repository workflow file, e.g .github/workflows/upload.yml
33+
34+
# ...
35+
# previous steps to choose a runner type, prepare files, etc
36+
# ...
37+
38+
- uses: azure/login@v1
39+
with:
40+
creds: ${{ secrets.AZURE_CREDENTIALS }}
41+
42+
# Upload `.jpg`s to Azure Blob Storage
43+
- name: Upload all JPGs to Azure Blob Storage
44+
id: upload
45+
uses: github-developer/upload-azure-blob@v1
46+
with:
47+
account: octodex
48+
destination: octocats
49+
source: '**/*.jpg'
50+
51+
# Print out the urls to uploaded files
52+
- name: Print URLs
53+
run: echo $URLS # { ["filename":"hulatocat.jpg","url":"https://octodex.blob.core.windows.net/octocats/hulatocat.jpg"] }
54+
env:
55+
URLS: ${{ steps.upload.outputs.urls }}
56+
57+
# ...
58+
```
59+
60+
### Inputs
61+
62+
- `account` (required): Storage account name, e.g. `mystorageaccount`
63+
- `destination` (required): Name of container to upload blob to, e.g. `$web` to upload a static website.
64+
- `source` (required): Path to file(s) to upload to `destination`, e.g. `.` to upload all files in the current directory. Supports globbing, e.g. `images/**.jpg`. For more information, please refer to https://www.npmjs.com/package/glob.
65+
66+
### Outputs
67+
68+
- `urls`: data structure with names and urls to uploaded files
69+
70+
## License
71+
72+
[MIT](LICENSE)
73+
74+
## Contributing
75+
76+
Pull requests are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for more.

0 commit comments

Comments
 (0)