Compare commits
39 Commits
v1.1.0
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3713a032c6 | ||
|
|
05b8ab586b | ||
|
|
8151732169 | ||
|
|
0c7edb5265 | ||
|
|
914f86730e | ||
|
|
dd928bb78a | ||
|
|
b46896c92b | ||
|
|
207f87da14 | ||
|
|
85020be43f | ||
|
|
84bddb7f82 | ||
|
|
2115c80e82 | ||
|
|
a7826c3d9e | ||
|
|
50a593740d | ||
|
|
80f4dc3682 | ||
|
|
60c150d787 | ||
|
|
2081cee43c | ||
|
|
9dea1aac7e | ||
|
|
fdb656e148 | ||
|
|
59fe15c39c | ||
|
|
865e26ae28 | ||
|
|
27dbb86e47 | ||
|
|
4191da5daf | ||
|
|
89a583bcb4 | ||
|
|
7de480550b | ||
|
|
6666bbeb34 | ||
|
|
f0d5c67ae8 | ||
|
|
a27182c923 | ||
|
|
fe25da5c69 | ||
|
|
da0dd6f825 | ||
|
|
e3a6534c61 | ||
|
|
121c208740 | ||
|
|
1d32a34314 | ||
|
|
9dba6ec80f | ||
|
|
7771e4ad5d | ||
|
|
0677c3a661 | ||
|
|
8b71dde9cc | ||
|
|
3c902f37b8 | ||
|
|
32ae336e72 | ||
|
|
8acd1073f5 |
@@ -1,4 +1,4 @@
|
|||||||
dist/
|
|
||||||
lib/
|
lib/
|
||||||
|
dist/
|
||||||
node_modules/
|
node_modules/
|
||||||
jest.config.js
|
coverage/
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["jest", "@typescript-eslint"],
|
|
||||||
"extends": ["plugin:github/recommended"],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 9,
|
|
||||||
"sourceType": "module",
|
|
||||||
"project": "./tsconfig.json"
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"i18n-text/no-en": "off",
|
|
||||||
"eslint-comments/no-use": "off",
|
|
||||||
"import/no-namespace": "off",
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
"@typescript-eslint/no-unused-vars": "error",
|
|
||||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
|
||||||
"@typescript-eslint/no-require-imports": "error",
|
|
||||||
"@typescript-eslint/array-type": "error",
|
|
||||||
"@typescript-eslint/await-thenable": "error",
|
|
||||||
"@typescript-eslint/ban-ts-comment": "error",
|
|
||||||
"camelcase": "off",
|
|
||||||
"@typescript-eslint/consistent-type-assertions": "error",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
|
||||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
|
||||||
"@typescript-eslint/no-array-constructor": "error",
|
|
||||||
"@typescript-eslint/no-empty-interface": "error",
|
|
||||||
"@typescript-eslint/no-explicit-any": "error",
|
|
||||||
"@typescript-eslint/no-extraneous-class": "error",
|
|
||||||
"@typescript-eslint/no-for-in-array": "error",
|
|
||||||
"@typescript-eslint/no-inferrable-types": "error",
|
|
||||||
"@typescript-eslint/no-misused-new": "error",
|
|
||||||
"@typescript-eslint/no-namespace": "error",
|
|
||||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
||||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
||||||
"@typescript-eslint/no-useless-constructor": "error",
|
|
||||||
"@typescript-eslint/no-var-requires": "error",
|
|
||||||
"@typescript-eslint/prefer-for-of": "warn",
|
|
||||||
"@typescript-eslint/prefer-function-type": "warn",
|
|
||||||
"@typescript-eslint/prefer-includes": "error",
|
|
||||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
||||||
"@typescript-eslint/promise-function-async": "error",
|
|
||||||
"@typescript-eslint/require-array-sort-compare": "error",
|
|
||||||
"@typescript-eslint/restrict-plus-operands": "error",
|
|
||||||
"semi": "off",
|
|
||||||
"@typescript-eslint/semi": ["error", "never"],
|
|
||||||
"@typescript-eslint/type-annotation-spacing": "error",
|
|
||||||
"@typescript-eslint/unbound-method": "error"
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest/globals": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1 +1,3 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
dist/** -diff linguist-generated=true
|
dist/** -diff linguist-generated=true
|
||||||
6
.github/codeql/codeql-config.yml
vendored
6
.github/codeql/codeql-config.yml
vendored
@@ -1,6 +0,0 @@
|
|||||||
name: "CodeQL config"
|
|
||||||
queries:
|
|
||||||
- uses: security-extended
|
|
||||||
- uses: security-and-quality
|
|
||||||
paths:
|
|
||||||
- src
|
|
||||||
19
.github/dependabot.yml
vendored
19
.github/dependabot.yml
vendored
@@ -3,9 +3,24 @@ updates:
|
|||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: /
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: monthly
|
||||||
|
groups:
|
||||||
|
actions-minor:
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
|
||||||
- package-ecosystem: npm
|
- package-ecosystem: npm
|
||||||
directory: /
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: monthly
|
||||||
|
groups:
|
||||||
|
npm-development:
|
||||||
|
dependency-type: development
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
npm-production:
|
||||||
|
dependency-type: production
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
|||||||
83
.github/linters/.eslintrc.yml
vendored
Normal file
83
.github/linters/.eslintrc.yml
vendored
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
env:
|
||||||
|
node: true
|
||||||
|
es6: true
|
||||||
|
jest: true
|
||||||
|
|
||||||
|
globals:
|
||||||
|
Atomics: readonly
|
||||||
|
SharedArrayBuffer: readonly
|
||||||
|
|
||||||
|
ignorePatterns:
|
||||||
|
- '!.*'
|
||||||
|
- '**/node_modules/.*'
|
||||||
|
- '**/dist/.*'
|
||||||
|
- '**/coverage/.*'
|
||||||
|
- '*.json'
|
||||||
|
|
||||||
|
parser: '@typescript-eslint/parser'
|
||||||
|
|
||||||
|
parserOptions:
|
||||||
|
ecmaVersion: 2023
|
||||||
|
sourceType: module
|
||||||
|
project:
|
||||||
|
- './.github/linters/tsconfig.json'
|
||||||
|
- './tsconfig.json'
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- jest
|
||||||
|
- '@typescript-eslint'
|
||||||
|
|
||||||
|
extends:
|
||||||
|
- eslint:recommended
|
||||||
|
- plugin:@typescript-eslint/eslint-recommended
|
||||||
|
- plugin:@typescript-eslint/recommended
|
||||||
|
- plugin:github/recommended
|
||||||
|
- plugin:jest/recommended
|
||||||
|
|
||||||
|
rules:
|
||||||
|
{
|
||||||
|
'camelcase': 'off',
|
||||||
|
'eslint-comments/no-use': 'off',
|
||||||
|
'eslint-comments/no-unused-disable': 'off',
|
||||||
|
'i18n-text/no-en': 'off',
|
||||||
|
'import/no-namespace': 'off',
|
||||||
|
'no-console': 'off',
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
'semi': 'off',
|
||||||
|
'@typescript-eslint/array-type': 'error',
|
||||||
|
'@typescript-eslint/await-thenable': 'error',
|
||||||
|
'@typescript-eslint/ban-ts-comment': 'error',
|
||||||
|
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||||
|
'@typescript-eslint/explicit-member-accessibility':
|
||||||
|
['error', { 'accessibility': 'no-public' }],
|
||||||
|
'@typescript-eslint/explicit-function-return-type':
|
||||||
|
['error', { 'allowExpressions': true }],
|
||||||
|
'@typescript-eslint/func-call-spacing': ['error', 'never'],
|
||||||
|
'@typescript-eslint/no-array-constructor': 'error',
|
||||||
|
'@typescript-eslint/no-empty-interface': 'error',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'error',
|
||||||
|
'@typescript-eslint/no-extraneous-class': 'error',
|
||||||
|
'@typescript-eslint/no-for-in-array': 'error',
|
||||||
|
'@typescript-eslint/no-inferrable-types': 'error',
|
||||||
|
'@typescript-eslint/no-misused-new': 'error',
|
||||||
|
'@typescript-eslint/no-namespace': 'error',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
||||||
|
'@typescript-eslint/no-require-imports': 'error',
|
||||||
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
||||||
|
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'error',
|
||||||
|
'@typescript-eslint/no-useless-constructor': 'error',
|
||||||
|
'@typescript-eslint/no-var-requires': 'error',
|
||||||
|
'@typescript-eslint/prefer-for-of': 'warn',
|
||||||
|
'@typescript-eslint/prefer-function-type': 'warn',
|
||||||
|
'@typescript-eslint/prefer-includes': 'error',
|
||||||
|
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
||||||
|
'@typescript-eslint/promise-function-async': 'error',
|
||||||
|
'@typescript-eslint/require-array-sort-compare': 'error',
|
||||||
|
'@typescript-eslint/restrict-plus-operands': 'error',
|
||||||
|
'@typescript-eslint/semi': ['error', 'never'],
|
||||||
|
'@typescript-eslint/space-before-function-paren': 'off',
|
||||||
|
'@typescript-eslint/type-annotation-spacing': 'error',
|
||||||
|
'@typescript-eslint/unbound-method': 'error'
|
||||||
|
}
|
||||||
9
.github/linters/tsconfig.json
vendored
Normal file
9
.github/linters/tsconfig.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": ["../../__tests__/**/*", "../../src/**/*"],
|
||||||
|
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
|
||||||
|
}
|
||||||
86
.github/workflows/check-dist.yml
vendored
86
.github/workflows/check-dist.yml
vendored
@@ -1,53 +1,83 @@
|
|||||||
# `dist/index.js` is a special file in Actions.
|
# In TypeScript actions, `dist/` is a special directory. When you reference
|
||||||
# When you reference an action with `uses:` in a workflow,
|
# an action with the `uses:` property, `dist/index.js` is the code that will be
|
||||||
# `index.js` is the code that will run.
|
# run. For this project, the `dist/index.js` file is transpiled from other
|
||||||
# For our project, we generate this file through a build process from other source files.
|
# source files. This workflow ensures the `dist/` directory contains the
|
||||||
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
|
# expected transpiled code.
|
||||||
name: Check dist/
|
#
|
||||||
|
# If this workflow is run from a feature branch, it will act as an additional CI
|
||||||
|
# check and fail if the checked-in `dist/` directory does not match what is
|
||||||
|
# expected from the build.
|
||||||
|
name: Check Transpiled JavaScript
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
permissions:
|
||||||
workflow_dispatch:
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-dist:
|
check-dist:
|
||||||
|
name: Check dist/
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v2.5.1
|
id: setup-node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version-file: .node-version
|
||||||
|
cache: npm
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install Dependencies
|
||||||
|
id: install
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Rebuild the dist/ directory
|
- name: Build dist/ Directory
|
||||||
run: |
|
id: build
|
||||||
npm run build
|
run: npm run bundle
|
||||||
npm run package
|
|
||||||
|
|
||||||
- name: Compare the expected and actual dist/ directories
|
# This will fail the workflow if the PR wasn't created by Dependabot.
|
||||||
|
- name: Compare Directories
|
||||||
|
id: diff
|
||||||
run: |
|
run: |
|
||||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
echo "Detected uncommitted changes after build. See status below:"
|
||||||
git diff
|
git diff --ignore-space-at-eol --text dist/
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
id: diff
|
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
# If `dist/` was different than expected, and this was not a Dependabot
|
||||||
- uses: actions/upload-artifact@v2
|
# PR, upload the expected version as a workflow artifact.
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
|
||||||
|
name: Upload Artifact
|
||||||
|
id: upload
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist/
|
path: dist/
|
||||||
|
|
||||||
|
push-dist:
|
||||||
|
name: Push dist/
|
||||||
|
needs: check-dist
|
||||||
|
if: ${{ failure() }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.head_ref }}
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
- run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add dist
|
||||||
|
git commit -m "Generate dist"
|
||||||
|
git push
|
||||||
|
|||||||
69
.github/workflows/ci.yml
vendored
Normal file
69
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
name: Continuous Integration
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-typescript:
|
||||||
|
name: TypeScript Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
id: setup-node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: .node-version
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
id: npm-ci
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Check Format
|
||||||
|
id: npm-format-check
|
||||||
|
run: npm run format:check
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
id: npm-lint
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
id: npm-ci-test
|
||||||
|
run: npm run ci-test
|
||||||
|
|
||||||
|
test-action:
|
||||||
|
name: GitHub Actions Test
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
version: [1.7.15, latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Test Local Action
|
||||||
|
id: test-action
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
ossutil-version: ${{ matrix.version }}
|
||||||
|
endpoint: ${{ secrets.OSS_ENDPOINT }}
|
||||||
|
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
|
||||||
|
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
||||||
|
|
||||||
|
- run: ossutil -v
|
||||||
|
- run: ossutil ls > /dev/null
|
||||||
|
shell: bash
|
||||||
73
.github/workflows/codeql.yml
vendored
73
.github/workflows/codeql.yml
vendored
@@ -1,73 +0,0 @@
|
|||||||
# For most projects, this workflow file will not need changing; you simply need
|
|
||||||
# to commit it to your repository.
|
|
||||||
#
|
|
||||||
# You may wish to alter this file to override the set of languages analyzed,
|
|
||||||
# or to provide custom queries or build logic.
|
|
||||||
#
|
|
||||||
# ******** NOTE ********
|
|
||||||
# We have attempted to detect the languages in your repository. Please check
|
|
||||||
# the `language` matrix defined below to confirm you have the correct set of
|
|
||||||
# supported CodeQL languages.
|
|
||||||
#
|
|
||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "master" ]
|
|
||||||
pull_request:
|
|
||||||
# The branches below must be a subset of the branches above
|
|
||||||
branches: [ "master" ]
|
|
||||||
schedule:
|
|
||||||
- cron: '25 23 * * 6'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
language: [ 'TypeScript' ]
|
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
||||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
config-file: ./.github/codeql/codeql-config.yml
|
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
||||||
# By default, queries listed here will override any specified in a config file.
|
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
||||||
|
|
||||||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
||||||
# queries: security-extended,security-and-quality
|
|
||||||
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v2
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
||||||
|
|
||||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
|
||||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
|
||||||
|
|
||||||
# - run: |
|
|
||||||
# echo "Run, Build Application using script"
|
|
||||||
# ./location_of_script_within_repo/buildscript.sh
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
20
.github/workflows/dependency-review.yml
vendored
20
.github/workflows/dependency-review.yml
vendored
@@ -1,20 +0,0 @@
|
|||||||
# Dependency Review Action
|
|
||||||
#
|
|
||||||
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
|
|
||||||
#
|
|
||||||
# Source repository: https://github.com/actions/dependency-review-action
|
|
||||||
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
|
|
||||||
name: 'Dependency Review'
|
|
||||||
on: [pull_request]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
dependency-review:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: 'Checkout Repository'
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: 'Dependency Review'
|
|
||||||
uses: actions/dependency-review-action@v2
|
|
||||||
24
.github/workflows/functional.yml
vendored
Normal file
24
.github/workflows/functional.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
name: Functional
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 2 * * 6'
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
functional:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
version: [1.7.15, latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: yizhoumo/setup-ossutil@v2
|
||||||
|
with:
|
||||||
|
ossutil-version: ${{ matrix.version }}
|
||||||
|
endpoint: ${{ secrets.OSS_ENDPOINT }}
|
||||||
|
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
|
||||||
|
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
||||||
|
- run: ossutil -v
|
||||||
|
- run: ossutil ls > /dev/null
|
||||||
|
shell: bash
|
||||||
30
.github/workflows/test.yml
vendored
30
.github/workflows/test.yml
vendored
@@ -1,30 +0,0 @@
|
|||||||
name: "build-test"
|
|
||||||
on: # rebuild any PRs and main branch changes
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build: # make sure build/ci work properly
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm run all
|
|
||||||
|
|
||||||
test: # make sure the action works on a clean machine without building
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: ./
|
|
||||||
with:
|
|
||||||
endpoint: ${{ secrets.OSS_ENDPOINT }}
|
|
||||||
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
|
|
||||||
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
|
||||||
- run: ossutil -v
|
|
||||||
- run: ossutil ls > /dev/null
|
|
||||||
shell: bash
|
|
||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -96,4 +96,8 @@ Thumbs.db
|
|||||||
|
|
||||||
# Ignore built ts files
|
# Ignore built ts files
|
||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
lib/**/*
|
|
||||||
|
# IDE files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.code-workspace
|
||||||
|
|||||||
1
.node-version
Normal file
1
.node-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
20.6.0
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
dist/
|
dist/
|
||||||
lib/
|
|
||||||
node_modules/
|
node_modules/
|
||||||
|
coverage/
|
||||||
|
|||||||
@@ -4,7 +4,13 @@
|
|||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
|
"quoteProps": "as-needed",
|
||||||
|
"jsxSingleQuote": false,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"bracketSpacing": false,
|
"bracketSpacing": true,
|
||||||
"arrowParens": "avoid"
|
"bracketSameLine": true,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"proseWrap": "always",
|
||||||
|
"htmlWhitespaceSensitivity": "css",
|
||||||
|
"endOfLine": "lf"
|
||||||
}
|
}
|
||||||
|
|||||||
13
LICENSE
13
LICENSE
@@ -1,7 +1,6 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
The MIT License (MIT)
|
Copyright GitHub
|
||||||
|
|
||||||
Copyright (c) 2018 GitHub, Inc. and contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -10,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in all
|
||||||
all copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
THE SOFTWARE.
|
SOFTWARE.
|
||||||
24
README.md
24
README.md
@@ -1,11 +1,13 @@
|
|||||||
# setup-ossutil
|
# setup-ossutil
|
||||||
|
|
||||||
[](https://github.com/yizhoumo/setup-ossutil/actions)
|
[](https://github.com/yizhoumo/setup-ossutil/actions/workflows/ci.yml)
|
||||||
|
[](https://github.com/yizhoumo/setup-ossutil/actions/workflows/functional.yml)
|
||||||
|
|
||||||
This action sets up [Alibaba Cloud OSSUTIL](https://github.com/aliyun/ossutil) for use in actions by:
|
This action provides the following functionality for GitHub Actions users:
|
||||||
|
|
||||||
- downloading and caching ossutil by version and adding to PATH
|
- Downloading and caching distribution of the requested [Alibaba Cloud OSSUTIL](https://github.com/aliyun/ossutil)
|
||||||
- configuring ossutil with your credentials
|
version, and adding it to the PATH
|
||||||
|
- Optionally configuring ossutil with the provided credential
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -13,13 +15,21 @@ See [action.yml](action.yml)
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: yizhoumo/setup-ossutil@v2
|
||||||
- uses: yizhoumo/setup-ossutil@v1
|
|
||||||
with:
|
with:
|
||||||
ossutil-version: '1.7.0' # Optional, default to 'latest'
|
## The version to download and use, or 'latest' for the latest version.
|
||||||
|
ossutil-version: '1.7.18'
|
||||||
|
|
||||||
|
# The following parameters are (optionally) used to config the credential.
|
||||||
|
## The endpoint of the region in which the bucket is located.
|
||||||
endpoint: ${{ secrets.OSS_ENDPOINT }}
|
endpoint: ${{ secrets.OSS_ENDPOINT }}
|
||||||
|
## The AccessKey ID of the credential.
|
||||||
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
|
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
|
||||||
|
## The AccessKey Secret of the credential.
|
||||||
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
||||||
|
## The STS Token of the credential. Only required for temporary access.
|
||||||
|
sts-token: ${{ secrets.OSS_STS_TOKEN }}
|
||||||
|
|
||||||
- run: ossutil cp -f file-to-upload.txt oss://your-bucket/path
|
- run: ossutil cp -f file-to-upload.txt oss://your-bucket/path
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
import * as io from '@actions/io'
|
||||||
|
import * as installer from '../src/installer'
|
||||||
|
|
||||||
const TOOL_DIR = path.join(__dirname, 'runner', 'tools')
|
const TOOL_DIR = path.join(__dirname, 'runner', 'tools')
|
||||||
const TEMP_DIR = path.join(__dirname, 'runner', 'temp')
|
const TEMP_DIR = path.join(__dirname, 'runner', 'temp')
|
||||||
process.env['RUNNER_TOOL_CACHE'] = TOOL_DIR
|
process.env['RUNNER_TOOL_CACHE'] = TOOL_DIR
|
||||||
process.env['RUNNER_TEMP'] = TEMP_DIR
|
process.env['RUNNER_TEMP'] = TEMP_DIR
|
||||||
|
|
||||||
import * as io from '@actions/io'
|
|
||||||
import * as installer from '../src/installer'
|
|
||||||
|
|
||||||
jest.setTimeout(60000)
|
jest.setTimeout(60000)
|
||||||
|
|
||||||
describe('installer tests', () => {
|
describe('installer tests', () => {
|
||||||
@@ -21,15 +20,11 @@ describe('installer tests', () => {
|
|||||||
await io.rmRF(TEMP_DIR)
|
await io.rmRF(TEMP_DIR)
|
||||||
})
|
})
|
||||||
|
|
||||||
const versions = ['1.7.0', 'latest']
|
const versions = ['1.7.15', 'latest']
|
||||||
|
|
||||||
it.each(versions)('install ossutil %s', async version => {
|
it.each(versions)('install ossutil %s', async version => {
|
||||||
await installer.getOssutil(version)
|
await installer.installOssutil(version)
|
||||||
|
|
||||||
expect(await io.which('ossutil', true)).toBeTruthy()
|
expect(await io.which('ossutil', true)).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throw if wrong version', async () => {
|
|
||||||
await expect(installer.getOssutil('1000.0.0')).rejects.toThrowError()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|||||||
48
action.yml
48
action.yml
@@ -1,26 +1,34 @@
|
|||||||
name: 'Setup OSSUTIL environment'
|
name: 'Setup OSSUTIL environment'
|
||||||
description: 'Download and config Alibaba Cloud OSSUTIL'
|
description: 'Download and config Alibaba Cloud OSSUTIL'
|
||||||
author: 'Rimo'
|
author: 'Rimo'
|
||||||
inputs:
|
|
||||||
ossutil-version:
|
# Add your action's branding here. This will appear on the GitHub Marketplace.
|
||||||
description: 'The OSSUTIL version to download and use'
|
|
||||||
required: false
|
|
||||||
default: 'latest'
|
|
||||||
endpoint:
|
|
||||||
description: 'The endpoint of your bucket'
|
|
||||||
required: true
|
|
||||||
access-key-id:
|
|
||||||
description: 'The AccessKeyID of the credentials'
|
|
||||||
required: true
|
|
||||||
access-key-secret:
|
|
||||||
description: 'The AccessKeySecret of the credentials'
|
|
||||||
required: true
|
|
||||||
sts-token:
|
|
||||||
description: 'The STS Token of the credentials'
|
|
||||||
required: false
|
|
||||||
runs:
|
|
||||||
using: 'node16'
|
|
||||||
main: 'dist/index.js'
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'download-cloud'
|
icon: 'download-cloud'
|
||||||
color: 'orange'
|
color: 'orange'
|
||||||
|
|
||||||
|
# Define your inputs here.
|
||||||
|
inputs:
|
||||||
|
ossutil-version:
|
||||||
|
description: 'The OSSUTIL version to download and use, or "latest" for the latest version.'
|
||||||
|
required: true
|
||||||
|
default: '1.7.18'
|
||||||
|
endpoint:
|
||||||
|
description: 'The endpoint of the region in which the bucket is located.'
|
||||||
|
required: false
|
||||||
|
access-key-id:
|
||||||
|
description: 'The AccessKey ID of the credential.'
|
||||||
|
required: false
|
||||||
|
access-key-secret:
|
||||||
|
description: 'The AccessKey Secret of the credential.'
|
||||||
|
required: false
|
||||||
|
sts-token:
|
||||||
|
description: 'The STS Token of the credential. Only required for STS temporary access credential.'
|
||||||
|
required: false
|
||||||
|
|
||||||
|
# Define your outputs here.
|
||||||
|
outputs: {}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: node20
|
||||||
|
main: dist/index.js
|
||||||
|
|||||||
24871
dist/index.js
generated
vendored
24871
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
1
dist/index.js.map
generated
vendored
1
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
47
dist/licenses.txt
generated
vendored
47
dist/licenses.txt
generated
vendored
@@ -71,6 +71,28 @@ The above copyright notice and this permission notice shall be included in all c
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
@fastify/busboy
|
||||||
|
MIT
|
||||||
|
Copyright Brian White. All rights reserved.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
semver
|
semver
|
||||||
ISC
|
ISC
|
||||||
The ISC License
|
The ISC License
|
||||||
@@ -115,6 +137,31 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
undici
|
||||||
|
MIT
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Matteo Collina and Undici contributors
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
uuid
|
uuid
|
||||||
MIT
|
MIT
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|||||||
1
dist/sourcemap-register.js
generated
vendored
1
dist/sourcemap-register.js
generated
vendored
File diff suppressed because one or more lines are too long
@@ -1,9 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
clearMocks: true,
|
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
|
||||||
testMatch: ['**/*.test.ts'],
|
|
||||||
transform: {
|
|
||||||
'^.+\\.ts$': 'ts-jest'
|
|
||||||
},
|
|
||||||
verbose: true
|
|
||||||
}
|
|
||||||
9865
package-lock.json
generated
9865
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
98
package.json
98
package.json
@@ -1,45 +1,91 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-ossutil",
|
"name": "setup-ossutil",
|
||||||
"version": "1.1.0",
|
"description": "Set up your GitHub Actions workflow with a specific version of ossutil.",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"author": "Rimo",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "setup ossutil action",
|
"homepage": "https://github.com/yizhoumo/setup-ossutil",
|
||||||
"main": "lib/setup-ossutil.js",
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsc",
|
|
||||||
"format": "prettier --write **/*.ts",
|
|
||||||
"format-check": "prettier --check **/*.ts",
|
|
||||||
"lint": "eslint src/**/*.ts",
|
|
||||||
"package": "ncc build --source-map --license licenses.txt",
|
|
||||||
"test": "jest",
|
|
||||||
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/yizhoumo/setup-ossutil.git"
|
"url": "git+https://github.com/yizhoumo/setup-ossutil.git"
|
||||||
},
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/yizhoumo/setup-ossutil/issues"
|
||||||
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
"ossutil",
|
"ossutil",
|
||||||
"setup"
|
"setup"
|
||||||
],
|
],
|
||||||
"author": "Rimo",
|
"exports": {
|
||||||
|
".": "./dist/index.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bundle": "npm run format:write && npm run package",
|
||||||
|
"ci-test": "jest",
|
||||||
|
"coverage": "make-coverage-badge --output-path ./badges/coverage.svg",
|
||||||
|
"format:write": "prettier --write **/*.ts",
|
||||||
|
"format:check": "prettier --check **/*.ts",
|
||||||
|
"lint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
|
||||||
|
"package": "ncc build src/index.ts --license licenses.txt",
|
||||||
|
"package:watch": "npm run package -- --watch",
|
||||||
|
"test": "jest",
|
||||||
|
"all": "npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"
|
||||||
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"jest": {
|
||||||
|
"preset": "ts-jest",
|
||||||
|
"verbose": true,
|
||||||
|
"clearMocks": true,
|
||||||
|
"testEnvironment": "node",
|
||||||
|
"moduleFileExtensions": [
|
||||||
|
"js",
|
||||||
|
"ts"
|
||||||
|
],
|
||||||
|
"testMatch": [
|
||||||
|
"**/*.test.ts"
|
||||||
|
],
|
||||||
|
"testPathIgnorePatterns": [
|
||||||
|
"/node_modules/",
|
||||||
|
"/dist/"
|
||||||
|
],
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.ts$": "ts-jest"
|
||||||
|
},
|
||||||
|
"coverageReporters": [
|
||||||
|
"json-summary",
|
||||||
|
"text",
|
||||||
|
"lcov"
|
||||||
|
],
|
||||||
|
"collectCoverage": true,
|
||||||
|
"collectCoverageFrom": [
|
||||||
|
"./src/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.6.0",
|
"@actions/core": "^1.10.1",
|
||||||
|
"@actions/http-client": "^2.2.1",
|
||||||
"@actions/tool-cache": "^2.0.1"
|
"@actions/tool-cache": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.0",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/node": "^16.10.5",
|
"@types/node": "^20.12.7",
|
||||||
"@typescript-eslint/parser": "^5.8.1",
|
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
||||||
"@vercel/ncc": "^0.31.1",
|
"@typescript-eslint/parser": "^6.19.0",
|
||||||
"eslint": "^8.0.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"eslint-plugin-github": "^4.3.2",
|
"eslint": "^8.57.0",
|
||||||
"eslint-plugin-jest": "^25.3.2",
|
"eslint-plugin-github": "^4.10.2",
|
||||||
"jest": "^27.2.5",
|
"eslint-plugin-jest": "^28.5.0",
|
||||||
"js-yaml": "^4.1.0",
|
"eslint-plugin-jsonc": "^2.15.1",
|
||||||
"prettier": "2.5.1",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"ts-jest": "^27.1.2",
|
"jest": "^29.7.0",
|
||||||
"typescript": "^4.4.4"
|
"make-coverage-badge": "^1.2.0",
|
||||||
|
"prettier": "^3.2.5",
|
||||||
|
"prettier-eslint": "^16.3.0",
|
||||||
|
"ts-jest": "^29.1.1",
|
||||||
|
"typescript": "^5.4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
47
script/release
Executable file
47
script/release
Executable file
@@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# About:
|
||||||
|
# This is a helper script to tag and push a new release.
|
||||||
|
# GitHub Actions use release tags to allow users to select a specific version of the action to use.
|
||||||
|
# This script will do the following:
|
||||||
|
# 1. Get the latest release tag
|
||||||
|
# 2. Prompt the user for a new release tag (while displaying the latest release tag, and a regex to validate the new tag)
|
||||||
|
# 3. Tag the new release
|
||||||
|
# 4. Push the new tag to the remote
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
# script/release
|
||||||
|
|
||||||
|
# COLORS
|
||||||
|
OFF='\033[0m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
|
||||||
|
latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
|
||||||
|
|
||||||
|
# if the latest_tag is empty, then there are no tags - let the user know
|
||||||
|
if [[ -z "$latest_tag" ]]; then
|
||||||
|
echo -e "No tags found (yet) - continue to create your first tag and push it"
|
||||||
|
latest_tag="[unknown]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}"
|
||||||
|
read -r -p 'New Release Tag (vX.X.X format): ' new_tag
|
||||||
|
|
||||||
|
tag_regex='v[0-9]+\.[0-9]+\.[0-9]+$'
|
||||||
|
if echo "$new_tag" | grep -q -E "$tag_regex"; then
|
||||||
|
echo -e "Tag: ${BLUE}$new_tag${OFF} is valid"
|
||||||
|
else
|
||||||
|
echo -e "Tag: ${BLUE}$new_tag${OFF} is ${RED}not valid${OFF} (must be in vX.X.X format)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git tag -a "$new_tag" -m "$new_tag Release"
|
||||||
|
|
||||||
|
echo -e "${GREEN}OK${OFF} - Tagged: $new_tag"
|
||||||
|
|
||||||
|
git push --tags
|
||||||
|
|
||||||
|
echo -e "${GREEN}OK${OFF} - Tags pushed to remote!"
|
||||||
|
echo -e "${GREEN}DONE${OFF}"
|
||||||
7
src/index.ts
Normal file
7
src/index.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* The entrypoint for the action.
|
||||||
|
*/
|
||||||
|
import { run } from './main'
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
run()
|
||||||
111
src/installer.ts
111
src/installer.ts
@@ -1,17 +1,19 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
|
import * as io from '@actions/io'
|
||||||
import * as tc from '@actions/tool-cache'
|
import * as tc from '@actions/tool-cache'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
import * as path from 'path'
|
||||||
import { HttpClient } from '@actions/http-client'
|
import { HttpClient } from '@actions/http-client'
|
||||||
|
|
||||||
const ToolName = 'ossutil'
|
const ToolName = 'ossutil'
|
||||||
const UpdateEndpoint =
|
const DownloadEndpoint = 'https://gosspublic.alicdn.com/ossutil'
|
||||||
'https://ossutil-version-update.oss-cn-hangzhou.aliyuncs.com'
|
const IS_WINDOWS = process.platform === 'win32'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ossutil ready for use
|
* Install ossutil to PATH
|
||||||
* @param version the version of ossutil
|
* @param version the version of ossutil
|
||||||
*/
|
*/
|
||||||
export async function getOssutil(version: string): Promise<void> {
|
export async function installOssutil(version: string): Promise<void> {
|
||||||
if (version.toLowerCase() === 'latest') {
|
if (version.toLowerCase() === 'latest') {
|
||||||
version = await getLatestVersion()
|
version = await getLatestVersion()
|
||||||
core.info(`Using the latest version of ossutil: ${version}`)
|
core.info(`Using the latest version of ossutil: ${version}`)
|
||||||
@@ -32,49 +34,102 @@ export async function getOssutil(version: string): Promise<void> {
|
|||||||
*/
|
*/
|
||||||
async function downloadOssutil(version: string): Promise<string> {
|
async function downloadOssutil(version: string): Promise<string> {
|
||||||
// download
|
// download
|
||||||
let toolFile: string
|
const zipFileName = getZipFileName(version)
|
||||||
|
let downloadedFile: string
|
||||||
try {
|
try {
|
||||||
const downloadUrl = getDownloadUrl(version)
|
const downloadUrl = `${DownloadEndpoint}/${version}/${zipFileName}.zip`
|
||||||
core.info(`Downloading ossutil from: ${downloadUrl}`)
|
core.info(`Downloading ossutil from: ${downloadUrl}`)
|
||||||
toolFile = await tc.downloadTool(downloadUrl)
|
downloadedFile = await tc.downloadTool(downloadUrl)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.error('Failed to download ossutil')
|
core.error('Failed to download ossutil')
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
core.debug(`ossutil downloaded to: ${toolFile}`)
|
core.info(`ossutil downloaded to: ${downloadedFile}`)
|
||||||
|
|
||||||
|
// extract
|
||||||
|
const zipFile = `${downloadedFile}.zip`
|
||||||
|
await io.mv(downloadedFile, zipFile)
|
||||||
|
const extractFolder = await tc.extractZip(zipFile)
|
||||||
|
const toolFileName = getToolFileName()
|
||||||
|
const toolFile = path.join(extractFolder, zipFileName, toolFileName)
|
||||||
|
if (fs.existsSync(toolFile)) {
|
||||||
|
core.info(`ossutil extracted to: ${toolFile}`)
|
||||||
|
} else {
|
||||||
|
throw new Error('Unrecognized zip file structure')
|
||||||
|
}
|
||||||
|
|
||||||
// change permission
|
// change permission
|
||||||
fs.chmodSync(toolFile, 0o755)
|
fs.chmodSync(toolFile, 0o755)
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
const fileName = process.platform === 'win32' ? `${ToolName}.exe` : ToolName
|
const cacheFileName = IS_WINDOWS ? `${ToolName}.exe` : ToolName
|
||||||
const toolPath = await tc.cacheFile(toolFile, fileName, ToolName, version)
|
const toolPath = await tc.cacheFile(
|
||||||
core.debug(`ossutil cached to: ${toolPath}`)
|
toolFile,
|
||||||
|
cacheFileName,
|
||||||
|
ToolName,
|
||||||
|
version
|
||||||
|
)
|
||||||
|
core.info(`ossutil installed to: ${toolPath}`)
|
||||||
return toolPath
|
return toolPath
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the URL of the specific version of ossutil
|
* Get the zip file name of the specific version of ossutil
|
||||||
* @param version the version of ossutil to download
|
* @param version the version of ossutil to download
|
||||||
* @returns the URL
|
* @returns the zip file name (e.g., ossutil-v1.7.19-linux-amd64)
|
||||||
*/
|
*/
|
||||||
function getDownloadUrl(version: string): string {
|
function getZipFileName(version: string): string {
|
||||||
let downloadUrl = `${UpdateEndpoint}/${version}/`
|
let platform = ''
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
downloadUrl += 'ossutil64'
|
platform = 'linux'
|
||||||
break
|
break
|
||||||
case 'win32':
|
case 'win32':
|
||||||
downloadUrl += 'ossutil64.exe'
|
platform = 'windows'
|
||||||
break
|
break
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
downloadUrl += 'ossutilmac64'
|
platform = 'mac'
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown platform ${process.platform}`)
|
throw new Error(`Unsupported platform: ${process.platform}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return downloadUrl
|
let arch = ''
|
||||||
|
switch (process.arch) {
|
||||||
|
case 'arm64':
|
||||||
|
arch = 'arm64'
|
||||||
|
break
|
||||||
|
case 'x64':
|
||||||
|
arch = 'amd64'
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported arch: ${process.arch}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return `ossutil-v${version}-${platform}-${arch}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the file name of ossutil
|
||||||
|
* @returns the file name (e.g., ossutil64)
|
||||||
|
*/
|
||||||
|
function getToolFileName(): string {
|
||||||
|
let filename = 'ossutil'
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'linux':
|
||||||
|
filename += '64'
|
||||||
|
break
|
||||||
|
case 'win32':
|
||||||
|
filename += '64.exe'
|
||||||
|
break
|
||||||
|
case 'darwin':
|
||||||
|
filename += 'mac64'
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported platform: ${process.platform}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return filename
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,8 +137,18 @@ function getDownloadUrl(version: string): string {
|
|||||||
* @returns the latest version
|
* @returns the latest version
|
||||||
*/
|
*/
|
||||||
async function getLatestVersion(): Promise<string> {
|
async function getLatestVersion(): Promise<string> {
|
||||||
const http = new HttpClient()
|
const http = new HttpClient('setup-ossutil', [], {
|
||||||
const response = await http.get(`${UpdateEndpoint}/ossutilversion`)
|
allowRetries: true,
|
||||||
|
maxRetries: 5
|
||||||
|
})
|
||||||
|
const versionFileUrl = `${DownloadEndpoint}/version.txt`
|
||||||
|
const response = await http.get(versionFileUrl)
|
||||||
const content = await response.readBody()
|
const content = await response.readBody()
|
||||||
return content.trim()
|
|
||||||
|
const versionFilePrefix = 'ossutil version: v'
|
||||||
|
if (content.startsWith(versionFilePrefix)) {
|
||||||
|
return content.substring(versionFilePrefix.length).trim()
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unrecognized version file content: ${content}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
54
src/main.ts
Normal file
54
src/main.ts
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import * as core from '@actions/core'
|
||||||
|
import * as exec from '@actions/exec'
|
||||||
|
import * as installer from './installer'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main function for the action.
|
||||||
|
* @returns {Promise<void>} Resolves when the action is complete.
|
||||||
|
*/
|
||||||
|
export async function run(): Promise<void> {
|
||||||
|
try {
|
||||||
|
await install()
|
||||||
|
await config()
|
||||||
|
} catch (error) {
|
||||||
|
// Fail the workflow run if an error occurs
|
||||||
|
if (error instanceof Error) core.setFailed(error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function install(): Promise<void> {
|
||||||
|
const version = core.getInput('ossutil-version', { required: true })
|
||||||
|
await installer.installOssutil(version)
|
||||||
|
core.info('ossutil is successfully installed')
|
||||||
|
}
|
||||||
|
|
||||||
|
async function config(): Promise<void> {
|
||||||
|
const endpoint = core.getInput('endpoint')
|
||||||
|
if (endpoint.length === 0) {
|
||||||
|
core.info('ossutil config is skipped')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const accessKeyId = core.getInput('access-key-id', { required: true })
|
||||||
|
const accessKeySecret = core.getInput('access-key-secret', { required: true })
|
||||||
|
const args = [
|
||||||
|
'config',
|
||||||
|
'--endpoint',
|
||||||
|
endpoint,
|
||||||
|
'--access-key-id',
|
||||||
|
accessKeyId,
|
||||||
|
'--access-key-secret',
|
||||||
|
accessKeySecret
|
||||||
|
]
|
||||||
|
const stsToken = core.getInput('sts-token')
|
||||||
|
if (stsToken) {
|
||||||
|
args.push('--sts-token', stsToken)
|
||||||
|
}
|
||||||
|
|
||||||
|
const exitCode = await exec.exec('ossutil', args)
|
||||||
|
if (exitCode === 0) {
|
||||||
|
core.info('ossutil config is done')
|
||||||
|
} else {
|
||||||
|
core.error(`ossutil config is failed with exit code: ${exitCode}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
import * as exec from '@actions/exec'
|
|
||||||
import * as installer from './installer'
|
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
|
||||||
try {
|
|
||||||
// download
|
|
||||||
const version = core.getInput('ossutil-version')
|
|
||||||
await installer.getOssutil(version)
|
|
||||||
core.info('ossutil is successfully installed')
|
|
||||||
|
|
||||||
// config
|
|
||||||
const inputOptions: core.InputOptions = {required: true}
|
|
||||||
const endpoint = core.getInput('endpoint', inputOptions)
|
|
||||||
const accessKeyId = core.getInput('access-key-id', inputOptions)
|
|
||||||
const accessKeySecret = core.getInput('access-key-secret', inputOptions)
|
|
||||||
const stsToken = core.getInput('sts-token')
|
|
||||||
const args = [
|
|
||||||
'config',
|
|
||||||
'--endpoint',
|
|
||||||
endpoint,
|
|
||||||
'--access-key-id',
|
|
||||||
accessKeyId,
|
|
||||||
'--access-key-secret',
|
|
||||||
accessKeySecret
|
|
||||||
]
|
|
||||||
if (stsToken) {
|
|
||||||
args.push('--sts-token', stsToken)
|
|
||||||
}
|
|
||||||
const exitCode = await exec.exec('ossutil', args)
|
|
||||||
if (exitCode === 0) {
|
|
||||||
core.info('ossutil config is done')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof Error) {
|
|
||||||
core.setFailed(error.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run()
|
|
||||||
@@ -1,12 +1,19 @@
|
|||||||
{
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
"target": "ES2022",
|
||||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
"module": "NodeNext",
|
||||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
"rootDir": "./src",
|
||||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
"moduleResolution": "NodeNext",
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
"baseUrl": "./",
|
||||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
"sourceMap": true,
|
||||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
"outDir": "./dist",
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"newLine": "lf"
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
"exclude": ["./dist", "./node_modules", "./__tests__", "./coverage"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user