Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Brocco committed Oct 17, 2023
0 parents commit 82ecb86
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 HeroDevs

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.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Shareable Github Actions

The actions defined in this repository can be reused across all of the NES github organization.

- [Init](#init)
- [Cache](#cache)
- [Uncache](#uncache)

## Init

This action will:

- authenticate with github
- checkout the code from the repo
- initialize node

```
- name: init
uses: neverendingsupport/actions/init@v1
with:
node-version: 18
```

## Cache

### Inputs

`job` - The name of the current job in which you wish to cache
NOTE - this is used to build the key name of the cache being created

### Usage
```
- name: cache
uses: neverendingsupport/actions/cache@v1
with:
job: [JOB_NAME]
```

## Uncache

### Inputs

`job-name` - The name of the job in which you wish to restore from.

### Usage
```
- name: uncache
uses: neverendingsupport/actions/uncache@v1
with:
from-job: [JOB_NAME]
```
15 changes: 15 additions & 0 deletions cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Cache'
description: 'Cache the workspace'
inputs:
job:
description: 'job name'
required: true

runs:
using: 'composite'
steps:
- name: save full cache
uses: actions/cache/save@v3
with:
path: '.'
key: ${{ github.ref_name }}-${{ inputs.job }}-${{ github.run_id }}
29 changes: 29 additions & 0 deletions init/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Initialize'
description: 'Initialize the workspace (checkout, auth, setup node)'
inputs:
node-version:
description: 'The version of node to use (default: 20)'
required: false
default: 20

runs:
using: 'composite'
steps:
# Checkout/get the latest code
- uses: actions/checkout@v3

# Authenticate
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# Set up node with the specified version
- uses: actions/setup-node@v3 v${{ inputs.node-version }}
with:
node-version: ${{ inputs.node-version }}
registry-url: https://npm.pkg.github.com
scope: "@neverendingsupport"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions uncache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Uncache'
description: 'Uncaches the workspace'
inputs:
from-job:
description: 'job name to restore from'
required: true

runs:
using: 'composite'
steps:
- name: restore full cache
uses: actions/cache/restore@v3
with:
path: '.'
key: ${{ github.ref_name }}-${{ inputs.from-job }}-${{ github.run_id }}

0 comments on commit 82ecb86

Please sign in to comment.