sync with upstream
This commit is contained in:
@@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1 +1,3 @@
|
|||||||
dist/** -diff linguist-generated=true
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
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
|
|
||||||
20
.github/dependabot.yml
vendored
20
.github/dependabot.yml
vendored
@@ -4,3 +4,23 @@ updates:
|
|||||||
directory: /
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: weekly
|
interval: weekly
|
||||||
|
groups:
|
||||||
|
actions-minor:
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
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'
|
||||||
|
}
|
||||||
7
.github/linters/.markdown-lint.yml
vendored
Normal file
7
.github/linters/.markdown-lint.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Unordered list style
|
||||||
|
MD004:
|
||||||
|
style: dash
|
||||||
|
|
||||||
|
# Ordered list item prefix
|
||||||
|
MD029:
|
||||||
|
style: one
|
||||||
10
.github/linters/.yaml-lint.yml
vendored
Normal file
10
.github/linters/.yaml-lint.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
rules:
|
||||||
|
document-end: disable
|
||||||
|
document-start:
|
||||||
|
level: warning
|
||||||
|
present: false
|
||||||
|
line-length:
|
||||||
|
level: warning
|
||||||
|
max: 80
|
||||||
|
allow-non-breakable-words: true
|
||||||
|
allow-non-breakable-inline-mappings: true
|
||||||
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"]
|
||||||
|
}
|
||||||
50
.github/workflows/build.yml
vendored
50
.github/workflows/build.yml
vendored
@@ -1,50 +0,0 @@
|
|||||||
name: "build"
|
|
||||||
on: # rebuild any PRs and main branch changes
|
|
||||||
pull_request:
|
|
||||||
branches: [ "master" ]
|
|
||||||
push:
|
|
||||||
branches: [ "master" ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build: # make sure build/ci work properly
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'npm'
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm run all
|
|
||||||
- name: Compare the expected and actual dist
|
|
||||||
run: |
|
|
||||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
|
||||||
git diff
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
id: diff
|
|
||||||
- name: upload the expected dist
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
||||||
|
|
||||||
test: # make sure the action works on a clean machine without building
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
version: [1.7.0, 1.7.14, latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- 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
|
|
||||||
64
.github/workflows/check-dist.yml
vendored
Normal file
64
.github/workflows/check-dist.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
# In TypeScript actions, `dist/` is a special directory. When you reference
|
||||||
|
# an action with the `uses:` property, `dist/index.js` is the code that will be
|
||||||
|
# run. For this project, the `dist/index.js` file is transpiled from other
|
||||||
|
# source files. This workflow ensures the `dist/` directory contains the
|
||||||
|
# expected transpiled code.
|
||||||
|
#
|
||||||
|
# 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:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-dist:
|
||||||
|
name: Check dist/
|
||||||
|
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: install
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build dist/ Directory
|
||||||
|
id: build
|
||||||
|
run: npm run bundle
|
||||||
|
|
||||||
|
# This will fail the workflow if the PR wasn't created by Dependabot.
|
||||||
|
- name: Compare Directories
|
||||||
|
id: diff
|
||||||
|
run: |
|
||||||
|
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
|
||||||
|
echo "Detected uncommitted changes after build. See status below:"
|
||||||
|
git diff --ignore-space-at-eol --text dist/
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If `dist/` was different than expected, and this was not a Dependabot
|
||||||
|
# PR, upload the expected version as a workflow artifact.
|
||||||
|
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
|
||||||
|
name: Upload Artifact
|
||||||
|
id: upload
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
||||||
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.0, 1.7.14, 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
|
||||||
48
.github/workflows/codeql-analysis.yml
vendored
Normal file
48
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: CodeQL
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
schedule:
|
||||||
|
- cron: '31 7 * * 3'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
checks: write
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language:
|
||||||
|
- TypeScript
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
id: initialize
|
||||||
|
uses: github/codeql-action/init@v3
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
source-root: src
|
||||||
|
|
||||||
|
- name: Autobuild
|
||||||
|
id: autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
id: analyze
|
||||||
|
uses: github/codeql-action/analyze@v3
|
||||||
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@v4
|
|
||||||
|
|
||||||
# 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@v4
|
|
||||||
- name: 'Dependency Review'
|
|
||||||
uses: actions/dependency-review-action@v3
|
|
||||||
45
.github/workflows/linter.yml
vendored
Normal file
45
.github/workflows/linter.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
name: Lint Codebase
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: read
|
||||||
|
statuses: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint Codebase
|
||||||
|
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: install
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Lint Codebase
|
||||||
|
id: super-linter
|
||||||
|
uses: super-linter/super-linter/slim@v5
|
||||||
|
env:
|
||||||
|
DEFAULT_BRANCH: main
|
||||||
|
FILTER_REGEX_EXCLUDE: dist/**/*
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TYPESCRIPT_DEFAULT_STYLE: prettier
|
||||||
|
VALIDATE_ALL_CODEBASE: true
|
||||||
|
VALIDATE_JAVASCRIPT_STANDARD: false
|
||||||
|
VALIDATE_JSCPD: false
|
||||||
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.
|
||||||
@@ -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', () => {
|
||||||
|
|||||||
18
action.yml
18
action.yml
@@ -1,6 +1,13 @@
|
|||||||
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'
|
||||||
|
|
||||||
|
# Add your action's branding here. This will appear on the GitHub Marketplace.
|
||||||
|
branding:
|
||||||
|
icon: 'download-cloud'
|
||||||
|
color: 'orange'
|
||||||
|
|
||||||
|
# Define your inputs here.
|
||||||
inputs:
|
inputs:
|
||||||
endpoint:
|
endpoint:
|
||||||
description: 'The endpoint of your bucket'
|
description: 'The endpoint of your bucket'
|
||||||
@@ -22,9 +29,10 @@ inputs:
|
|||||||
description: 'The GitHub token used to call API to fetch the latest version info'
|
description: 'The GitHub token used to call API to fetch the latest version info'
|
||||||
required: false
|
required: false
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
|
|
||||||
|
# Define your outputs here.
|
||||||
|
outputs:
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: node20
|
||||||
main: 'dist/index.js'
|
main: dist/index.js
|
||||||
branding:
|
|
||||||
icon: 'download-cloud'
|
|
||||||
color: 'orange'
|
|
||||||
|
|||||||
29977
dist/index.js
generated
vendored
29977
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
@@ -83,6 +83,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.
|
||||||
|
|
||||||
@octokit/auth-token
|
@octokit/auth-token
|
||||||
MIT
|
MIT
|
||||||
The MIT License
|
The MIT License
|
||||||
@@ -606,6 +628,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.
|
||||||
|
|
||||||
|
|
||||||
universal-user-agent
|
universal-user-agent
|
||||||
ISC
|
ISC
|
||||||
# [ISC License](https://spdx.org/licenses/ISC)
|
# [ISC License](https://spdx.org/licenses/ISC)
|
||||||
|
|||||||
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
|
|
||||||
}
|
|
||||||
9992
package-lock.json
generated
9992
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
95
package.json
95
package.json
@@ -1,46 +1,91 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-ossutil",
|
"name": "setup-ossutil",
|
||||||
|
"description": "GitHub Action to setup ossutil",
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
|
"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/github": "^5.1.0",
|
"@actions/github": "^5.1.0",
|
||||||
"@actions/tool-cache": "^2.0.1"
|
"@actions/tool-cache": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.0",
|
"@types/jest": "^29.5.11",
|
||||||
"@types/node": "^16.10.5",
|
"@types/node": "^20.11.5",
|
||||||
"@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.56.0",
|
||||||
"eslint-plugin-jest": "^25.3.2",
|
"eslint-plugin-github": "^4.10.1",
|
||||||
"jest": "^27.2.5",
|
"eslint-plugin-jest": "^27.6.3",
|
||||||
"js-yaml": "^4.1.0",
|
"eslint-plugin-jsonc": "^2.12.2",
|
||||||
"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.4",
|
||||||
|
"prettier-eslint": "^16.3.0",
|
||||||
|
"ts-jest": "^29.1.1",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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()
|
||||||
@@ -92,7 +92,7 @@ function getDownloadUrl(version: string): string {
|
|||||||
* @returns the latest version
|
* @returns the latest version
|
||||||
*/
|
*/
|
||||||
async function getLatestVersion(): Promise<string> {
|
async function getLatestVersion(): Promise<string> {
|
||||||
const token = core.getInput('github-token', {required: true})
|
const token = core.getInput('github-token', { required: true })
|
||||||
const octokit = github.getOctokit(token)
|
const octokit = github.getOctokit(token)
|
||||||
const response = await octokit.rest.repos.getLatestRelease({
|
const response = await octokit.rest.repos.getLatestRelease({
|
||||||
owner: 'aliyun',
|
owner: 'aliyun',
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ import * as core from '@actions/core'
|
|||||||
import * as exec from '@actions/exec'
|
import * as exec from '@actions/exec'
|
||||||
import * as installer from './installer'
|
import * as installer from './installer'
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
/**
|
||||||
|
* The main function for the action.
|
||||||
|
* @returns {Promise<void>} Resolves when the action is complete.
|
||||||
|
*/
|
||||||
|
export async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// download
|
// download
|
||||||
const version = core.getInput('ossutil-version')
|
const version = core.getInput('ossutil-version')
|
||||||
@@ -10,7 +14,7 @@ async function run(): Promise<void> {
|
|||||||
core.info('ossutil is successfully installed')
|
core.info('ossutil is successfully installed')
|
||||||
|
|
||||||
// config
|
// config
|
||||||
const inputOptions: core.InputOptions = {required: true}
|
const inputOptions: core.InputOptions = { required: true }
|
||||||
const endpoint = core.getInput('endpoint', inputOptions)
|
const endpoint = core.getInput('endpoint', inputOptions)
|
||||||
const accessKeyId = core.getInput('access-key-id', inputOptions)
|
const accessKeyId = core.getInput('access-key-id', inputOptions)
|
||||||
const accessKeySecret = core.getInput('access-key-secret', inputOptions)
|
const accessKeySecret = core.getInput('access-key-secret', inputOptions)
|
||||||
@@ -32,10 +36,7 @@ async function run(): Promise<void> {
|
|||||||
core.info('ossutil config is done')
|
core.info('ossutil config is done')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
// Fail the workflow run if an error occurs
|
||||||
core.setFailed(error.message)
|
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