Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/** -diff linguist-generated=true
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
# Enable version updates for npm
- package-ecosystem: "npm"
# Look for `package.json` and `lock` files in the `root` directory
directory: "/"
# Check the npm registry for updates every day (weekdays)
schedule:
interval: "daily"
21 changes: 21 additions & 0 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Branch Build

on:
push:
branches-ignore:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Build dist files
run: npm run build
- name: Commit changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git diff-index --quiet HEAD || (git commit -a -m'ci: update dist files [bot] [skip ci]' --allow-empty && git push -f)
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Build dist files
run: npm run build
- name: Commit changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git diff-index --quiet HEAD || (git commit -a -m'ci: update dist files [bot] [skip ci]' --allow-empty && git push -f)
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "units-test"
on:
pull_request:
push:
branches:
- main
- releases/*

jobs:
# unit tests
units:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm ci
- run: npm test
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
node_modules/

# Editors
.vscode/
.idea/
*.iml

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Other Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 GitHub Actions

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
104 changes: 103 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,103 @@
# AWS CodeArtifact Auth
# AWS CodeArtifact Auth
<p align="center">
<a href="https://standardjs.com"><img alt="JavaScript Style Guide" src="https://img.shields.io/badge/code_style-standard-brightgreen.svg"></a>
<a href="https://github.com/advancedcsg-open/actions-aws-codeartifact-auth/actions"><img alt="javscript-action status" src="https://github.com/advancedcsg-open/actions-aws-codeartifact-auth/workflows/units-test/badge.svg"></a>
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fadvancedcsg-open%2Factions-aws-codeartifact-auth?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fadvancedcsg-open%2Factions-aws-codeartifact-auth.svg?type=shield"/></a>
<a href="https://sonarcloud.io/dashboard?id=advancedcsg-open_actions-aws-codeartifact-auth"><img alt="Quality Gate Status" src="https://sonarcloud.io/api/project_badges/measure?project=advancedcsg-open_actions-aws-codeartifact-auth&metric=alert_status"></a>
</p>

---

Used to authorize with AWS CodeArtifact in order to publish packages.

## Usage

### Pre-requisites
---
Requires `aws-actions/configure-aws-credentials` to have been ran first with an appropriate role that can access CodeArtifact.

### Inputs

#### `region`

The AWS region.

#### `domain`

The name of the domain that is in scope for the generated authorization token.

#### `domain-owner`

The 12-digit account number of the AWS account that owns the domain. It does not include dashes or spaces.

#### `duration`

The time, in seconds, that the generated authorization token is valid. Valid values are 0 and any number between 900 (15 minutes) and 43200 (12 hours). A value of 0 will set the expiration of the authorization token to the same expiration of the user's role's temporary credentials. Defaults to 0.

### Exported Variables

The action will export the following variables. These can then be used in conjunction with the package managers to publish artifacts.

#### NPM

| Name | Description |
|----------------------|--------------------------|
| NPM_TOKEN | The authentication token |

#### PYPI

| Name | Description |
|----------------------|-------------------------------------------|
| TWINE_USERNAME | The authentication username. Set as `aws` |
| TWINE_PASSWORD | The authentication token |

#### Maven

| Name | Description |
|----------------------|-------------------------------------------|
| MAVEN_USERNAME | The authentication username. Set as `aws` |
| MAVEN_TOKEN | The authentication token |

#### Nuget

| Name | Description |
|----------------------|-------------------------------------------|
| NUGET_AUTH_TOKEN | The authentication token |

### Example
---
```yaml
# .github/workflows/aws-codeartifact-auth.yml
name: AWS CodeArtifact Auth
on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
- name: AWS CodeArtifact Auth
uses: advancedcsg-open/actions-aws-codeartifact-auth
with:
region: ${{ secrets.AWS_REGION }}
domain: ${{ secrets.AWS_CODEARTIFACT_DOMAIN }}
domain-owner: ${{ secrets.AWS_CODEARTIFACT_DOMAIN_OWNER }}
- name: Publish npm
run: |
npm publish
```

### License

actions-aws-codeartifact-auth is licensed under the MIT License. See the LICENSE file for more info.

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fadvancedcsg-open%2Factions-aws-codeartifact-auth.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fadvancedcsg-open%2Factions-aws-codeartifact-auth?ref=badge_large)
26 changes: 26 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'AWS CodeArtifact Auth'
author: Paul Mowat
description: 'Github action for authenticating with AWS CodeArtifact'
runs:
using: 'node16'
main: 'dist/main/index.js'
branding:
icon: 'check'
color: 'gray-dark'
inputs:
region:
description: 'AWS CodeArtifact Region'
required: true
domain:
description: 'AWS CodeArtifact Domain'
required: true
domain-owner:
description: 'AWS CodeArtifact Domain Owner'
required: true
duration:
description: 'The time, in seconds, that the generated authorization token is valid'
required: false
default: '0'
outputs:
aws-codeartifact-token: # output will be available to future steps
description: 'AWS CodeArtifact authentication token'
Loading