Skip to content

Commit c76e253

Browse files
committed
feat: ༼ つ ◕_◕ ༽つ give setup action for elide
Signed-off-by: Sam Gammon <[email protected]>
1 parent 74daee7 commit c76e253

21 files changed

+56047
-9394
lines changed

.github/workflows/check-dist.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# In TypeScript actions, `dist/index.js` is a special file. When you reference
2-
# an action with `uses:`, `dist/index.js` is the code that will be run. For this
3-
# project, the `dist/index.js` file is generated from other source files through
4-
# the build process. We need to make sure that the checked-in `dist/index.js`
5-
# file matches what is expected from the build.
6-
#
7-
# This workflow will fail if the checked-in `dist/index.js` file does not match
8-
# what is expected from the build.
9-
name: Check dist/
1+
name: Check Dist
102

113
on:
124
push:
@@ -21,33 +13,36 @@ on:
2113

2214
jobs:
2315
check-dist:
24-
name: Check dist/
16+
name: "Check: Dist"
2517
runs-on: ubuntu-latest
2618

2719
permissions:
2820
contents: read
2921
statuses: write
3022

3123
steps:
32-
- name: Checkout
24+
- name: "Setup: Checkout"
3325
id: checkout
3426
uses: actions/checkout@v4
3527

36-
- name: Setup Node.js
28+
- name: "Setup: PNPM"
29+
uses: pnpm/action-setup@v2
30+
31+
- name: "Setup: Node"
3732
uses: actions/setup-node@v3
3833
with:
39-
node-version: 18
40-
cache: npm
34+
node-version: 20
35+
cache: pnpm
4136

42-
- name: Install Dependencies
37+
- name: "Setup: Install Dependencies"
4338
id: install
44-
run: npm ci
39+
run: pnpm install
4540

46-
- name: Build dist/ Directory
41+
- name: "Build: Bundle"
4742
id: build
4843
run: npm run bundle
4944

50-
- name: Compare Expected and Actual Directories
45+
- name: "Check: Compare Expected and Actual Directories"
5146
id: diff
5247
run: |
5348
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
@@ -56,9 +51,8 @@ jobs:
5651
exit 1
5752
fi
5853
59-
# If index.js was different than expected, upload the expected version as
60-
# a workflow artifact.
61-
- uses: actions/upload-artifact@v3
54+
- name: "Build: Upload Artifact"
55+
uses: actions/upload-artifact@v3
6256
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
6357
with:
6458
name: dist

.github/workflows/ci.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Continuous Integration
1+
name: CI
22

33
on:
44
pull_request:
@@ -13,32 +13,35 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- name: Checkout
16+
- name: "Setup: Checkout"
1717
id: checkout
1818
uses: actions/checkout@v4
1919

20-
- name: Setup Node.js
20+
- name: "Setup: PNPM"
21+
uses: pnpm/action-setup@v2
22+
23+
- name: "Setup: Node"
2124
id: setup-node
2225
uses: actions/setup-node@v3
2326
with:
24-
node-version: 18
25-
cache: npm
27+
node-version: 20
28+
cache: pnpm
2629

27-
- name: Install Dependencies
30+
- name: "Setup: Install Dependencies"
2831
id: npm-ci
29-
run: npm ci
32+
run: pnpm install
3033

3134
- name: Check Format
3235
id: npm-format-check
33-
run: npm run format:check
36+
run: pnpm run format:check
3437

3538
- name: Lint
3639
id: npm-lint
37-
run: npm run lint
40+
run: pnpm run lint
3841

3942
- name: Test
4043
id: npm-ci-test
41-
run: npm run ci-test
44+
run: pnpm run ci-test
4245

4346
test-action:
4447
name: GitHub Actions Test
@@ -52,9 +55,8 @@ jobs:
5255
- name: Test Local Action
5356
id: test-action
5457
uses: ./
55-
with:
56-
milliseconds: 1000
58+
with: {}
5759

5860
- name: Print Output
5961
id: output
60-
run: echo "${{ steps.test-action.outputs.time }}"
62+
run: echo "${{ steps.test-action.outputs.path }}"

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
registry=https://npm.pkg.st/
2+
timeout=30000

CODEOWNERS

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
# Repository CODEOWNERS
2-
3-
* @actions/actions-runtime
4-
* @ncalteen
1+
* @elide-dev/engineering
2+
* @sgammon

README.md

Lines changed: 4 additions & 196 deletions
Original file line numberDiff line numberDiff line change
@@ -1,199 +1,7 @@
1-
# Create a JavaScript Action Using TypeScript
21

3-
[![GitHub Super-Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
4-
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)
2+
## GitHub Action: Setup Elide
53

6-
Use this template to bootstrap the creation of a TypeScript action. :rocket:
4+
This repository provides a [GitHub Action][0] to setup the [Elide][1] runtime within your workflows.
75

8-
This template includes compilation support, tests, a validation workflow,
9-
publishing, and versioning guidance.
10-
11-
If you are new, there's also a simpler introduction in the
12-
[Hello world JavaScript action repository](https://github.com/actions/hello-world-javascript-action).
13-
14-
## Create Your Own Action
15-
16-
To create your own action, you can use this repository as a template! Just
17-
follow the below instructions:
18-
19-
1. Click the **Use this template** button at the top of the repository
20-
1. Select **Create a new repository**
21-
1. Select an owner and name for your new repository
22-
1. Click **Create repository**
23-
1. Clone your new repository
24-
25-
## Initial Setup
26-
27-
After you've cloned the repository to your local machine or codespace, you'll
28-
need to perform some initial setup steps before you can develop your action.
29-
30-
> [!NOTE]
31-
>
32-
> You'll need to have a reasonably modern version of
33-
> [Node.js](https://nodejs.org) handy. If you are using a version manager like
34-
> [`nodenv`](https://github.com/nodenv/nodenv) or
35-
> [`nvm`](https://github.com/nvm-sh/nvm), you can run `nodenv install` in the
36-
> root of your repository to install the version specified in
37-
> [`package.json`](./package.json). Otherwise, 20.x or later should work!
38-
39-
1. :hammer_and_wrench: Install the dependencies
40-
41-
```bash
42-
npm install
43-
```
44-
45-
1. :building_construction: Package the TypeScript for distribution
46-
47-
```bash
48-
npm run bundle
49-
```
50-
51-
1. :white_check_mark: Run the tests
52-
53-
```bash
54-
$ npm test
55-
56-
PASS ./index.test.js
57-
✓ throws invalid number (3ms)
58-
wait 500 ms (504ms)
59-
test runs (95ms)
60-
61-
...
62-
```
63-
64-
## Update the Action Metadata
65-
66-
The [`action.yml`](action.yml) file defines metadata about your action, such as
67-
input(s) and output(s). For details about this file, see
68-
[Metadata syntax for GitHub Actions](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions).
69-
70-
When you copy this repository, update `action.yml` with the name, description,
71-
inputs, and outputs for your action.
72-
73-
## Update the Action Code
74-
75-
The [`src/`](./src/) directory is the heart of your action! This contains the
76-
source code that will be run when your action is invoked. You can replace the
77-
contents of this directory with your own code.
78-
79-
There are a few things to keep in mind when writing your action code:
80-
81-
- Most GitHub Actions toolkit and CI/CD operations are processed asynchronously.
82-
In `main.ts`, you will see that the action is run in an `async` function.
83-
84-
```javascript
85-
import * as core from '@actions/core'
86-
//...
87-
88-
async function run() {
89-
try {
90-
//...
91-
} catch (error) {
92-
core.setFailed(error.message)
93-
}
94-
}
95-
```
96-
97-
For more information about the GitHub Actions toolkit, see the
98-
[documentation](https://github.com/actions/toolkit/blob/master/README.md).
99-
100-
So, what are you waiting for? Go ahead and start customizing your action!
101-
102-
1. Create a new branch
103-
104-
```bash
105-
git checkout -b releases/v1
106-
```
107-
108-
1. Replace the contents of `src/` with your action code
109-
1. Add tests to `__tests__/` for your source code
110-
1. Format, test, and build the action
111-
112-
```bash
113-
npm run all
114-
```
115-
116-
> [!WARNING]
117-
>
118-
> This step is important! It will run [`ncc`](https://github.com/vercel/ncc)
119-
> to build the final JavaScript action code with all dependencies included.
120-
> If you do not run this step, your action will not work correctly when it is
121-
> used in a workflow. This step also includes the `--license` option for
122-
> `ncc`, which will create a license file for all of the production node
123-
> modules used in your project.
124-
125-
1. Commit your changes
126-
127-
```bash
128-
git add .
129-
git commit -m "My first action is ready!"
130-
```
131-
132-
1. Push them to your repository
133-
134-
```bash
135-
git push -u origin releases/v1
136-
```
137-
138-
1. Create a pull request and get feedback on your action
139-
1. Merge the pull request into the `main` branch
140-
141-
Your action is now published! :rocket:
142-
143-
For information about versioning your action, see
144-
[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
145-
in the GitHub Actions toolkit.
146-
147-
## Validate the Action
148-
149-
You can now validate the action by referencing it in a workflow file. For
150-
example, [`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an
151-
action in the same repository.
152-
153-
```yaml
154-
steps:
155-
- name: Checkout
156-
id: checkout
157-
uses: actions/checkout@v3
158-
159-
- name: Test Local Action
160-
id: test-action
161-
uses: ./
162-
with:
163-
milliseconds: 1000
164-
165-
- name: Print Output
166-
id: output
167-
run: echo "${{ steps.test-action.outputs.time }}"
168-
```
169-
170-
For example workflow runs, check out the
171-
[Actions tab](https://github.com/actions/typescript-action/actions)! :rocket:
172-
173-
## Usage
174-
175-
After testing, you can create version tag(s) that developers can use to
176-
reference different stable versions of your action. For more information, see
177-
[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
178-
in the GitHub Actions toolkit.
179-
180-
To include the action in a workflow in another repository, you can use the
181-
`uses` syntax with the `@` symbol to reference a specific branch, tag, or commit
182-
hash.
183-
184-
```yaml
185-
steps:
186-
- name: Checkout
187-
id: checkout
188-
uses: actions/checkout@v3
189-
190-
- name: Test Local Action
191-
id: test-action
192-
uses: actions/typescript-action@v1 # Commit with the `v1` tag
193-
with:
194-
milliseconds: 1000
195-
196-
- name: Print Output
197-
id: output
198-
run: echo "${{ steps.test-action.outputs.time }}"
199-
```
6+
[0]: https://github.com/features/actions
7+
[1]: https://elide.dev

0 commit comments

Comments
 (0)