Setup mark installation (#1)

This commit is contained in:
Eugene 2024-03-26 21:37:02 +09:00 committed by GitHub
parent 66157c3405
commit d73995205d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 648 additions and 2 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1 @@
* @fabasoad

5
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,5 @@
---
custom: ["https://en.cryptobadges.io/donate/145HwyQAcv4vrzUumJhu7nWGAVBysX9jJH"]
github: ["fabasoad"]
ko_fi: fabasoad
liberapay: fabasoad

37
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: bug
assignees: fabasoad
---
#### Describe the bug
A clear and concise description of what the bug is.
#### Steps to Reproduce
1. Run '...'
2. See error
#### Expected behavior
A clear and concise description of what you expected to happen.
#### Actual behavior
A clear and concise description of what is happening now.
#### Screenshots
If applicable, add screenshots to help explain your problem.
#### Technical information (please complete the following information)
- OS: [e.g. Windows 10 Enterprise v.1909 (OS Build 18363.720)]
- `setup-mark-action` version [e.g. 0.1.0]
#### Additional context
Add any other context about the problem here.

View File

@ -0,0 +1,25 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: enhancement
assignees: fabasoad
---
#### Is your feature request related to a problem? Please describe
A clear and concise description of what the problem is. Ex. I'm always frustrated
when [...]
#### Describe the solution you'd like
A clear and concise description of what you want to happen.
#### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've
considered.
#### Additional context
Add any other context or screenshots about the feature request here.

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
reviewers:
- "fabasoad"
labels:
- "dependencies"

78
.github/labels.yml vendored Normal file
View File

@ -0,0 +1,78 @@
---
- name: "breaking-change"
color: ee0701
description: "A breaking change for existing users."
- name: "bugfix"
color: ee0701
description: "Inconsistencies or issues which will cause a problem for users or implementors."
- name: "documentation"
color: 0052cc
description: "Solely about the documentation of the project."
- name: "enhancement"
color: 1d76db
description: "Enhancement of the code, not introducing new features."
- name: "refactor"
color: 1d76db
description: "Improvement of existing code, not introducing new features."
- name: "performance"
color: 1d76db
description: "Improving performance, not introducing new features."
- name: "new-feature"
color: 0e8a16
description: "New features or options."
- name: "maintenance"
color: 2af79e
description: "Generic maintenance tasks."
- name: "ci"
color: 1d76db
description: "Work that improves the continue integration."
- name: "dependencies"
color: 1d76db
description: "Upgrade or downgrade of project dependencies."
- name: "in-progress"
color: fbca04
description: "Issue is currently being resolved by a developer."
- name: "stale"
color: fef2c0
description: "There has not been activity on this issue or PR for quite some time."
- name: "no-stale"
color: fef2c0
description: "This issue or PR is exempted from the stable bot."
- name: "security"
color: ee0701
description: "Marks a security issue that needs to be resolved asap."
- name: "incomplete"
color: fef2c0
description: "Marks a PR or issue that is missing information."
- name: "invalid"
color: fef2c0
description: "Marks a PR or issue that is missing information."
- name: "beginner-friendly"
color: 0e8a16
description: "Good first issue for people wanting to contribute to the project."
- name: "help-wanted"
color: 0e8a16
description: "We need some extra helping hands or expertise in order to resolve this."
- name: "priority-critical"
color: ee0701
description: "This should be dealt with ASAP. Not fixing this issue would be a serious error."
- name: "priority-high"
color: b60205
description: "After critical issues are fixed, these should be dealt with before any further issues."
- name: "priority-medium"
color: 0e8a16
description: "This issue may be useful, and needs some attention."
- name: "priority-low"
color: e4ea8a
description: "Nice addition, maybe... someday..."
- name: "major"
color: b60205
description: "This PR causes a major version bump in the version number."
- name: "minor"
color: 0e8a16
description: "This PR causes a minor version bump in the version number."

59
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,59 @@
<!-- markdownlint-disable-file MD041 -->
## Pull request checklist
Please check if your PR fulfills the following requirements:
- [ ] I have read the [CONTRIBUTING](https://github.com/fabasoad/setup-mark-action/blob/main/CONTRIBUTING.md)
doc.
- [ ] Tests for the changes have been added (for bug fixes / features).
- [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features).
## Pull request type
<!-- Please do not submit updates to dependencies unless it fixes an issue. -->
<!-- Please try to limit your pull request to one type, submit multiple pull
requests if needed. -->
Please check the type of change your PR introduces:
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):
## What is the current behavior
<!-- Please describe the current behavior that you are modifying, or link to a
relevant issue. -->
## What is the new behavior
<!-- Please describe the behavior or changes that are being added by this PR. -->
-
-
-
## Does this introduce a breaking change
- [ ] Yes
- [ ] No
<!-- If this introduces a breaking change, please describe the impact and
migration path for existing applications below. -->
## Other information
<!-- Any other information that is important to this PR such as screenshots of
how the component looks before and after the change. -->
<!-- This document was adapted from the open-source [appium/appium](https://github.com/appium/appium/blob/master/.github/PULL_REQUEST_TEMPLATE.md)
repository. -->
---
Closes #{IssueNumber}

36
.github/workflows/functional-tests.yml vendored Normal file
View File

@ -0,0 +1,36 @@
---
name: Functional Tests
on: # yamllint disable-line rule:truthy
push:
branches:
- main
pull_request:
paths:
- .github/workflows/functional-tests.yml
- src/**
- action.yml
defaults:
run:
shell: sh
jobs:
setup-mark:
name: Setup mark
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos"]
version: ["9.11.1", "9.11.0", "9.10.1", "9.10.0", "9.9.0"]
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Setup mark
uses: ./
with:
version: "${{ matrix.version }}"
- name: Print version
run: mark --version

13
.github/workflows/linting.yml vendored Normal file
View File

@ -0,0 +1,13 @@
---
name: Linting
on: # yamllint disable-line rule:truthy
pull_request: {}
push:
branches:
- main
jobs:
pre-commit:
name: Pre-commit
uses: fabasoad/reusable-workflows/.github/workflows/wf-pre-commit.yml@main

36
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,36 @@
---
name: Release
on: # yamllint disable-line rule:truthy
push:
tags:
- "v*.*.*"
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changelog
id: changelog
uses: simbo/changes-since-last-release-action@v1
- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
body: |
# Changelog
${{ steps.changelog.outputs.log }}
draft: false
prerelease: false
- name: Bump tags
uses: fischerscode/tagger@v0
with:
prefix: v

51
.github/workflows/security.yml vendored Normal file
View File

@ -0,0 +1,51 @@
---
name: Security
on: # yamllint disable-line rule:truthy
pull_request: {}
push:
branches:
- main
defaults:
run:
shell: sh
jobs:
code-scanning:
name: Code scanning
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: "javascript"
- name: Perform CodeQL Analysis
id: codeql-analysis
uses: github/codeql-action/analyze@v3
- name: Upload to GHAS
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
category: "code-scanning"
sarif_file: "${{ steps.codeql-analysis.outputs.sarif-output }}"
directory-scanning:
name: Directory scanning
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Scan current project
id: scan-directory
uses: anchore/scan-action@v3
with:
by-cve: "true"
path: "."
- name: Upload to GHAS
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
category: "directory-scanning"
sarif_file: "${{ steps.scan-directory.outputs.sarif }}"

23
.github/workflows/sync-labels.yml vendored Normal file
View File

@ -0,0 +1,23 @@
---
name: Sync labels
on: # yamllint disable-line rule:truthy
push:
branches:
- main
paths:
- .github/labels.yml
- .github/workflows/sync-labels.yml
workflow_dispatch:
jobs:
sync-labels:
name: Sync labels
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Run Label Syncer
uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

30
.github/workflows/update-license.yml vendored Normal file
View File

@ -0,0 +1,30 @@
---
name: Update license
on: # yamllint disable-line rule:truthy
schedule:
- cron: "0 5 1 1 *"
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update LICENSE file
uses: FantasticFiasco/action-update-license-year@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
assignees: ${{ github.repository_owner }}
labels: enhancement
prTitle: Update license copyright year to {{currentYear}}
prBody: |
## Changelog
- Update license copyright year to {{currentYear}}
---
Powered by [FantasticFiasco/action-update-license-year](https://github.com/FantasticFiasco/action-update-license-year)

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.DS_Store
.envrc
.idea
.vscode

6
.markdownlint.yml Normal file
View File

@ -0,0 +1,6 @@
---
default: true
MD013:
code_blocks: false
tables: false
MD041: false

52
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,52 @@
---
default_install_hook_types: ["pre-commit", "pre-push"]
default_stages: ["commit"]
minimum_pre_commit_version: 2.18.0
repos:
# Security
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
stages: ["commit", "push"]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.2
hooks:
- id: gitleaks
stages: ["commit", "push"]
# Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
hooks:
- id: markdownlint-fix
# Yaml
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
stages: ["push"]
# GitHub Actions
- repo: https://github.com/rhysd/actionlint
rev: v1.6.27
hooks:
- id: actionlint
args: ["-pyflakes="]
stages: ["push"]
# Other
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: check-json
stages: ["push"]
- id: detect-private-key
stages: ["commit", "push"]
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- id: no-commit-to-branch
- id: trailing-whitespace

10
.yamllint.yml Normal file
View File

@ -0,0 +1,10 @@
---
extends: default
rules:
comments:
min-spaces-from-content: 1
line-length:
max: 165
allow-non-breakable-inline-mappings: true
level: error

59
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,59 @@
# Contributing guidance
We love your input! We want to make contributing to this project as easy and
transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer
## We develop with GitHub
We use GitHub to host code, to track issues and feature requests, as well as
accept pull requests.
## We use GitHub flow, so all code changes happen through pull requests
Pull requests are the best way to propose changes to the codebase (we use
[GitHub flow](https://guides.github.com/introduction/flow/index.html)). We
actively welcome your pull requests:
1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. Issue that pull request!
## Any contributions you make will be under the MIT Software License
In short, when you submit code changes, your submissions are understood to be
under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers
the project. Feel free to contact the maintainers if that's a concern.
## Report bugs using [GitHub Issues](https://github.com/fabasoad/setup-mark-action/issues)
We use GitHub issues to track public bugs. Report a bug by opening a new issue.
It's that easy!
## Create issue using provided GitHub issue templates
This repository has issue templates for bug report and feature request. Please
use them to create an issue and fill all required fields.
## Use a consistent coding style
Please follow all the rules from [this](https://google.github.io/styleguide/shellguide.html)
great guide provided by Google for coding style.
## License
By contributing, you agree that your contributions will be licensed under its
MIT License.
## References
This document was adapted from the open-source contribution guidelines provided
by [briandk](https://gist.github.com/briandk/3d2e8b3ec8daf5a27a62).

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Yevhen Fabizhevskyi
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.

View File

@ -1,2 +1,32 @@
# setup-mark-action
This GitHub action installs kovetskiy/mark CLI.
# Setup mark action
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
![Release](https://img.shields.io/github/v/release/fabasoad/setup-mark-action?include_prereleases)
![functional-tests](https://github.com/fabasoad/setup-mark-action/actions/workflows/functional-tests.yml/badge.svg)
![security](https://github.com/fabasoad/setup-mark-action/actions/workflows/security.yml/badge.svg)
![linting](https://github.com/fabasoad/setup-mark-action/actions/workflows/linting.yml/badge.svg)
This action installs [mark](https://github.com/kovetskiy/mark) CLI tool.
Supported OS: Linux and macOS.
## Prerequisites
The following tools have to be available on a runner prior using this GitHub
action:
- [curl](https://curl.se/)
- [tar](https://www.gnu.org/software/tar/)
## Inputs
```yaml
- uses: fabasoad/setup-mark-action@v0
with:
# (Optional) mark version. Defaults to "9.11.1".
version: "9.11.1"
```
## Outputs
None.

21
action.yml Normal file
View File

@ -0,0 +1,21 @@
---
name: "Setup mark"
author: Yevhen Fabizhevskyi
description: "This action installs mark CLI tool."
branding:
icon: terminal
color: gray-dark
inputs:
version:
description: "mark version."
required: false
default: "9.11.1"
runs:
using: "composite"
steps:
- name: Install kovetskiy/mark
env:
INPUT_VERSION: "${{ inputs.version }}"
run: ./install-mark.sh "${INPUT_VERSION}"
shell: sh
working-directory: ${{ github.action_path }}/src

38
src/install-mark.sh Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env sh
mark_version="$1"
# shellcheck disable=SC2039
if command -v mark >/dev/null 2>&1; then
msg="$(mark --version) is already installed. Skipping installation."
printf "[setup-mark-action] %s level=info %s\n" "$(date +'%Y-%m-%d %T')" "${msg}"
exit 0
fi
url=""
if [ "${RUNNER_OS}" = "macOS" ]; then
if [ "${RUNNER_ARCH}" = "X64" ]; then
url="https://github.com/kovetskiy/mark/releases/download/${mark_version}/mark_Darwin_x86_64.tar.gz"
elif [ "${RUNNER_ARCH}" = "ARM64" ]; then
url="https://github.com/kovetskiy/mark/releases/download/${mark_version}/mark_Darwin_arm64.tar.gz"
fi
elif [ "${RUNNER_OS}" = "Linux" ]; then
if [ "${RUNNER_ARCH}" = "X64" ]; then
url="https://github.com/kovetskiy/mark/releases/download/${mark_version}/mark_Linux_x86_64.tar.gz"
elif [ "${RUNNER_ARCH}" = "ARM64" ]; then
url="https://github.com/kovetskiy/mark/releases/download/${mark_version}/mark_Linux_arm64.tar.gz"
fi
fi
if [ -z "${url}" ]; then
echo "::error title=OS is not supported::${RUNNER_OS} ${RUNNER_ARCH} is not supported"
exit 1
fi
bin_path="${RUNNER_TEMP}/bin"
mkdir -p "${bin_path}"
tar_path="${bin_path}/mark.tar.gz"
curl -sL "${url}" -o "${tar_path}"
tar -xf "${tar_path}" -C "${bin_path}"
rm -f "${tar_path}"
echo "${bin_path}" >> "$GITHUB_PATH"