Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[email protected] #3

Merged
merged 7 commits into from
Aug 7, 2024
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
13 changes: 5 additions & 8 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ on:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.ref }}

group: ${{ github.workflow }}-${{ github.ref }}
jobs:
validate:
runs-on: ${{ matrix.os }}
Expand All @@ -23,14 +21,13 @@ jobs:
os: [ macos-latest, windows-latest, ubuntu-latest ]

steps:
- name: checkout self
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: RageAgainstThePixel/upm-config
uses: ./
with:
registry_url: ${{ secrets.UPM_REGISTRY_URL }}
auth_token: ${{ secrets.UPM_AUTH_TOKEN }}
registry-url: ${{ secrets.UPM_REGISTRY_URL }}
auth-token: ${{ secrets.UPM_AUTH_TOKEN }}

- run: |
# macOS and Linux '~/.upmconfig.toml'
Expand All @@ -54,7 +51,7 @@ jobs:
- name: RageAgainstThePixel/upm-config
uses: ./
with:
registry_url: ${{ secrets.UPM_REGISTRY_URL }}
registry-url: ${{ secrets.UPM_REGISTRY_URL }}
username: ${{ secrets.UPM_USERNAME }}
password: ${{ secrets.UPM_PASSWORD }}

Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
# upm-config

A GitHub action for setting Unity UPM private scoped registry credentials.
A GitHub Action for setting Unity Engine UPM private scoped registry credentials in CI/CD workflows.

## How to use

### workflow

```yaml
steps:
- uses: RageAgainstThePixel/upm-config@v1
- uses: RageAgainstThePixel/upm-config@v2
with:
registry_url: 'http://upm.registry.com:4873'
registry-url: 'http://upm.registry.com:4873'
username: ${{ secrets.UPM_USERNAME }}
password: ${{ secrets.UPM_PASSWORD }}

```

### inputs

| name | description | required |
| ---- | ----------- | -------- |
| registry_url | The URL of the private scoped registry. | true |
| auth_token | The authentication token for the private scoped registry. | Required if username and password are not provided. |
| username | The username for the private scoped registry. | Required if auth_token is not provided. |
| password | The password for the private scoped registry. | Required if auth_token is not provided. |
| always_auth | Whether to always authenticate with the private scoped registry. Defaults to true. | false |
| `registry-url` | The URL of the private scoped registry. | true |
| `auth-token` | The authentication token for the private scoped registry. | Required if username and password are not provided. |
| `username` | The username for the private scoped registry. | Required if auth-token is not provided. |
| `password` | The password for the private scoped registry. | Required if auth-token is not provided. |
| `always-auth` | Whether to always authenticate with the private scoped registry. Defaults to `true`. | false |
8 changes: 4 additions & 4 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: 'upm-config'
description: 'A GitHub action for setting Unity UPM private scoped registry configurations.'
description: 'A GitHub Action for setting Unity UPM private scoped registry configurations in CI/CD workflows.'

inputs:
registry_url:
registry-url:
description: 'The URL of the private scoped registry.'
required: true
auth_token:
auth-token:
description: 'The authentication token for the private scoped registry. Required if username and password are not provided.'
required: false
username:
Expand All @@ -14,7 +14,7 @@ inputs:
password:
description: 'The password for the private scoped registry. Required if auth_token is not provided.'
required: false
always_auth:
always-auth:
description: 'Whether to always authenticate with the private scoped registry. Defaults to true.'
required: false
default: 'true'
Expand Down
7 changes: 4 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26156,8 +26156,8 @@ const path = __nccwpck_require__(1017);
const fs = __nccwpck_require__(3292);

async function Run() {
const registry_url = core.getInput('registry_url', { required: true });
let auth_token = core.getInput('auth_token');
const registry_url = core.getInput('registry-url', { required: true });
let auth_token = core.getInput('auth-token');
if (!auth_token) {
const username = core.getInput('username', { required: true });
const password = core.getInput('password', { required: true });
Expand Down Expand Up @@ -26245,7 +26245,7 @@ async function save_upm_config(registry_url, auth_token) {
}
const upm_config_toml = await fs.readFile(upm_config_toml_path, 'utf-8');
if (!upm_config_toml.includes(registry_url)) {
const alwaysAuth = core.getInput('alwaysAuth') === 'true';
const alwaysAuth = core.getInput('always-auth') === 'true';
await fs.appendFile(upm_config_toml_path, `registry_url = "${registry_url}"\nauth_token = "${auth_token}"\nalwaysAuth = ${alwaysAuth}\n`);
}
}
Expand Down Expand Up @@ -28185,6 +28185,7 @@ const main = async () => {
await upm_config.Run();
} catch (error) {
core.setFailed(error);
process.exit(1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "upm-config",
"version": "1.0.0",
"description": "A GitHub action for setting Unity UPM private scoped registry credentials.",
"version": "2.0.0",
"description": "A GitHub action for setting Unity UPM private scoped registry credentials in CI/CD workflows.",
"author": "RageAgainstThePixel",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/RageAgainstThePixel/upm-config.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/RageAgainstThePixel/upm-config/issues"
},
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const main = async () => {
await upm_config.Run();
} catch (error) {
core.setFailed(error);
process.exit(1);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/upm_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const path = require('path');
const fs = require('fs/promises');

async function Run() {
const registry_url = core.getInput('registry_url', { required: true });
let auth_token = core.getInput('auth_token');
const registry_url = core.getInput('registry-url', { required: true });
let auth_token = core.getInput('auth-token');
if (!auth_token) {
const username = core.getInput('username', { required: true });
const password = core.getInput('password', { required: true });
Expand Down Expand Up @@ -93,7 +93,7 @@ async function save_upm_config(registry_url, auth_token) {
}
const upm_config_toml = await fs.readFile(upm_config_toml_path, 'utf-8');
if (!upm_config_toml.includes(registry_url)) {
const alwaysAuth = core.getInput('alwaysAuth') === 'true';
const alwaysAuth = core.getInput('always-auth') === 'true';
await fs.appendFile(upm_config_toml_path, `registry_url = "${registry_url}"\nauth_token = "${auth_token}"\nalwaysAuth = ${alwaysAuth}\n`);
}
}
Expand Down