Skip to content

Commit

Permalink
Initial import of npm-package-versioner code (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-matt-hillsdon authored Apr 16, 2024
1 parent 648ae30 commit 09bb586
Show file tree
Hide file tree
Showing 21 changed files with 3,761 additions and 336 deletions.
5 changes: 3 additions & 2 deletions .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ rules:
'@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/prefer-string-starts-ends-with': 'off',
'@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'
'@typescript-eslint/unbound-method': 'error',
'prefer-template': 'off'
}
5 changes: 1 addition & 4 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
name: Check Transpiled JavaScript

on:
pull_request:
branches:
- main
push:
branches:
- main
- '**'

permissions:
contents: read
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Continuous Integration

on:
pull_request:
branches:
- main
push:
branches:
- main
- '**'

permissions:
contents: read
Expand Down Expand Up @@ -56,9 +53,3 @@ jobs:
- name: Test Local Action
id: test-action
uses: ./
with:
milliseconds: 2000

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
3 changes: 0 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: CodeQL

on:
pull_request:
branches:
- main
push:
branches:
- main
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Lint Codebase

on:
pull_request:
branches:
- main
push:
branches:
- main
- '**'

permissions:
contents: read
Expand Down
3 changes: 0 additions & 3 deletions CODEOWNERS

This file was deleted.

4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright GitHub
Copyright Micro:bit Educational Foundation, GitHub

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ 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.
SOFTWARE.
62 changes: 9 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
# Create a GitHub Action Using TypeScript
# NPM package versioner GitHub action

[![GitHub Super-Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)
[![Check dist/](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml)
[![CodeQL](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml)
[![Coverage](./badges/coverage.svg)](./badges/coverage.svg)

Use this template to bootstrap the creation of a TypeScript action. :rocket:
Manages the `package.json` version field for GitHub action.

This template includes compilation support, tests, a validation workflow,
publishing, and versioning guidance.
The action will write the new version number to package.json.

If you are new, there's also a simpler introduction in the
[Hello world JavaScript action repository](https://github.com/actions/hello-world-javascript-action).
Usage:

## Create Your Own Action

To create your own action, you can use this repository as a template! Just
follow the below instructions:

1. Click the **Use this template** button at the top of the repository
1. Select **Create a new repository**
1. Select an owner and name for your new repository
1. Click **Create repository**
1. Clone your new repository

> [!IMPORTANT]
>
> Make sure to remove or update the [`CODEOWNERS`](./CODEOWNERS) file! For
> details on how to use this file, see
> [About code owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners).
```yaml
steps:
- uses: microbit-foundation/npm-package-versioner-action@v1
```
## Initial Setup
## Development documentation from template repository
After you've cloned the repository to your local machine or codespace, you'll
need to perform some initial setup steps before you can develop your action.
Expand Down Expand Up @@ -72,15 +58,6 @@ need to perform some initial setup steps before you can develop your action.
...
```

## Update the Action Metadata

The [`action.yml`](action.yml) file defines metadata about your action, such as
input(s) and output(s). For details about this file, see
[Metadata syntax for GitHub Actions](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions).

When you copy this repository, update `action.yml` with the name, description,
inputs, and outputs for your action.

## Update the Action Code

The [`src/`](./src/) directory is the heart of your action! This contains the
Expand Down Expand Up @@ -206,24 +183,3 @@ steps:
id: output
run: echo "${{ steps.test-action.outputs.time }}"
```
## Publishing a New Release
This project includes a helper script, [`script/release`](./script/release)
designed to streamline the process of tagging and pushing new releases for
GitHub Actions.

GitHub Actions allows users to select a specific version of the action to use,
based on release tags. This script simplifies this process by performing the
following steps:

1. **Retrieving the latest release tag:** The script starts by fetching the most
recent release tag by looking at the local data available in your repository.
1. **Prompting for a new release tag:** The user is then prompted to enter a new
release tag. To assist with this, the script displays the latest release tag
and provides a regular expression to validate the format of the new tag.
1. **Tagging the new release:** Once a valid new tag is entered, the script tags
the new release.
1. **Pushing the new tag to the remote:** Finally, the script pushes the new tag
to the remote repository. From here, you will need to create a new release in
GitHub and users can easily reference the new tag in their workflows.
89 changes: 0 additions & 89 deletions __tests__/main.test.ts

This file was deleted.

Loading

0 comments on commit 09bb586

Please sign in to comment.