Initial commit

This commit is contained in:
Pavel Zwerschke
2023-09-03 15:47:13 +02:00
commit fbf149e35d
20 changed files with 5617 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
module.exports = {
ignorePatterns: ['dist/**/*', 'build/**/*'],
extends: ['standard', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: '2020'
},
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'import/order': 'error',
'no-use-before-define': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'n/no-callback-literal': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/no-use-before-define': 'error',
'prettier/prettier': [
'error',
{
tabWidth: 2,
printWidth: 120,
singleQuote: true,
trailingComma: 'none',
semi: false
}
]
}
}
+1
View File
@@ -0,0 +1 @@
dist/** -diff linguist-generated=true
+1
View File
@@ -0,0 +1 @@
* @pavelzw
+16
View File
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
dev-dependencies:
patterns:
- "*eslint*"
- "@types/*"
- "prettier"
+23
View File
@@ -0,0 +1,23 @@
changelog:
exclude:
labels:
- ignore for release
categories:
- title: New features
labels:
- enhancement
- title: CI
labels:
- ci
- title: Bug fixes
labels:
- bug
- title: Documentation
labels:
- documentation
- title: Dependency updates
labels:
- dependencies
- title: Other changes
labels:
- "*"
+52
View File
@@ -0,0 +1,52 @@
#!/bin/env bash
version="${TAG_NAME}"
major="${version%%.*}" # see https://linuxjournal.com/article/8919 for an explanation of this bash magic
git tag "${version}"
git push origin "${version}"
push_worked=$?
if [ $push_worked -eq 0 ]; then
echo "Created ${version} tag on remote."
echo "Created \`${version}\` tag on remote." >> "$GITHUB_STEP_SUMMARY"
else
echo "Failed to push ${version} tag to remote."
echo "Failed to push \`${version}\` tag to remote." >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
git tag -d "${major}"
local_delete=$?
if [ $local_delete -eq 0 ]; then
echo "Deleted local tag ${major}."
echo "Deleted local tag \`${major}\`." >> "$GITHUB_STEP_SUMMARY"
else
echo "No local tag ${major} to delete."
echo "No local tag \`${major}\` to delete." >> "$GITHUB_STEP_SUMMARY"
fi
git tag "${major}"
git push -d origin "${major}"
remote_delete=$?
if [ $remote_delete -eq 0 ]; then
echo "Deleted remote tag ${major}."
echo "Deleted remote tag \`${major}\`." >> "$GITHUB_STEP_SUMMARY"
else
echo "No remote tag ${major} to delete."
echo "No remote tag \`${major}\` to delete." >> "$GITHUB_STEP_SUMMARY"
fi
git push origin "${major}"
push_worked=$?
if [ $push_worked -ne 0 ]; then
echo "Failed to push ${major} tag to remote."
echo "Failed to push \`${major}\` tag to remote." >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
if [ $remote_delete -eq 0 ]; then
echo "Result: moved ${major} -> ${version} tag on remote."
echo "Result: moved \`${major}\` -> \`${version}\` tag on remote." >> "$GITHUB_STEP_SUMMARY"
else
echo "Result: created ${major} -> ${version} tag on remote."
echo "Result: created \`${major}\` -> \`${version}\` tag on remote." >> "$GITHUB_STEP_SUMMARY"
fi
+48
View File
@@ -0,0 +1,48 @@
name: Check dist
on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:
jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Rebuild the dist/ directory
run: pnpm build
- name: Compare the expected and actual dist/ directories
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
# If index.js or post.js are different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
+31
View File
@@ -0,0 +1,31 @@
name: Release if version changed
on:
push:
branches: main
permissions:
contents: write
# To release a new version, update the version in package.json.
# This will create a draft release with the changelog and push a 'vx' tag that points to the new release as well as 'vx.y.z'.
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Quantco/ui-actions/version-metadata@v1
id: version-metadata
with:
file: ./package.json
token: ${{ secrets.GITHUB_TOKEN }}
- run: .github/scripts/release.sh
if: steps.version-metadata.outputs.changed == 'true'
env:
TAG_NAME: v${{ steps.version-metadata.outputs.newVersion }}
- name: Create release
if: steps.version-metadata.outputs.changed == 'true'
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
tag_name: v${{ steps.version-metadata.outputs.newVersion }}
draft: true
+99
View File
@@ -0,0 +1,99 @@
# Dependency directory
node_modules
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# OS metadata
.DS_Store
Thumbs.db
# Ignore built ts files
__tests__/runner/*
lib/**/*
+28
View File
@@ -0,0 +1,28 @@
BSD 3-Clause License
Copyright (c) 2023, Pavel Zwerschke
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+97
View File
@@ -0,0 +1,97 @@
name: setup-pixi
description: Install the pixi package manager
author: Pavel Zwerschke
branding:
icon: package
color: yellow
inputs:
condarc-file:
description: |
Path to a condarc file to use
condarc:
description: |
Contents of a condarc file to use.
environment-file:
description: |
Path to the `environment.yml` or `.lock` file for the environment.
environment-name:
description: |
Name of the environment to create. Overrides the name in the environment file.
create-args:
description: |
Extra arguments to pass to `micromamba create`.
Also possible to list extra specs to install into the environment.
For multiple packages, separate using spaces or use multiline syntax:
```yml
create-args: package1 package2
# or
create-args: >-
package1
package2
```
log-level:
description: |
Log level for micromamba.
One of `'trace'`, `'debug'`, `'info'`, `'warning'`, `'error'`, `'critical'`, `'off'`.
micromamba-version:
description: |
Version of micromamba to install.
Must match with a micromamba version from the https://github.com/mamba-org/micromamba-releases repository or 'latest'.
micromamba-url:
description: |
URL to download micromamba from.
init-shell:
description: |
Which shells to initialize micromamba in.
Also possible to list multiple shells using spaces or use multiline syntax:
```yml
init-shell: bash cmd.exe powershell
# or
init-shell: >-
bash
cmd.exe
powershell
```
To initialize no shell, use `'none'`.
Also supports other shells than bash, cmd.exe and powershell, but they are not tested.
generate-run-shell:
description: |
Whether to generate a custom shell script that allows to use it in the workflow file using `run: micromamba-shell {0}`
cache-downloads:
description: |
Whether to cache downloads or not.
cache-downloads-key:
description: |
Cache key to use for caching.
cache-environment:
description: |
Whether to cache the environment or not.
cache-environment-key:
description: |
Cache key to use for caching.
post-cleanup:
description: |
Which kind of cleanup to do after the action.
`'none'` - do not cleanup anything.
`'shell-init'` - cleanup only the shell initialization scripts.
`'environment'` - cleanup the installed environment and shell initialization scripts.
`'all'` - cleanup everything including the whole micromamba root folder and the micromamba binary.
micromamba-root-path:
description: |
Path to the micromamba root folder.
Defaults to `~/micromamba`.
micromamba-binary-path:
description: |
Path to the micromamba binary.
Defaults to `~/micromamba-bin/micromamba`.
Also specifies the path to the custom condarc which is located in the same folder as the micromamba binary.
outputs:
environment-path:
description: Path to the created environment. Only populated if environment was created, i.e., `environment-file` or `environment-name` was specified.
runs:
using: node20
main: dist/index.js
post: dist/post.js
+1
View File
@@ -0,0 +1 @@
*.js.map
Generated Vendored
+2250
View File
File diff suppressed because it is too large Load Diff
Generated Vendored
+5
View File
@@ -0,0 +1,5 @@
"use strict";
// src/post.ts
console.log("post");
//# sourceMappingURL=post.js.map
+47
View File
@@ -0,0 +1,47 @@
{
"name": "setup-pixi",
"version": "0.1.0",
"private": true,
"description": "Action to set up the pixi package manager.",
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"lint": "eslint ./src --ext ts",
"all": "npm run build && npm run lint"
},
"repository": {
"type": "git",
"url": "git+https://github.com/prefix-dev/setup-pixi.git"
},
"keywords": [
"setup",
"pixi",
"conda"
],
"author": "Pavel Zwerschke <pavelzw@gmail.com>",
"license": "BSD-3-Clause",
"dependencies": {
"@actions/cache": "^3.2.2",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1",
"untildify": "^5.0.0",
"zod": "^3.22.2"
},
"devDependencies": {
"@types/node": "^20.5.1",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"typescript": "^5.1.6"
}
}
+2846
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
import * as core from '@actions/core'
const run = async () => {
core.info('Hello World!')
}
run()
+1
View File
@@ -0,0 +1 @@
console.log('post')
+12
View File
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
},
"exclude": ["node_modules", "**/*.test.ts"]
}
+24
View File
@@ -0,0 +1,24 @@
import { defineConfig } from 'tsup'
export default defineConfig({
entry: {
index: 'src/main.ts',
post: 'src/post.ts'
},
dts: false,
clean: true,
target: 'es2020',
format: ['cjs'],
sourcemap: true,
minify: false,
// need to bundle dependencies because they aren't available otherwise when run inside the action
noExternal: [
'@actions/core',
'@actions/exec',
'@actions/cache',
'@actions/io',
'@actions/tool-cache',
'untildify',
'zod'
]
})