Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b89a3bcda5 | |||
| 61f5f4ef43 | |||
| d04cdab04b | |||
| 179e15ae5f | |||
| 01fcbce3a9 | |||
| c5fe1e8810 | |||
| 213f97e472 | |||
| a2fb068356 | |||
| 985cde05bb | |||
| 682aa7b9e0 | |||
| a4d16b3fb0 | |||
| 605b504f86 |
@@ -1,24 +0,0 @@
|
||||
name: 'Get & Cache Dependencies'
|
||||
description: 'Get the Dependencies from the cache for a (npm) Node JS Project or initialize the cache for it'
|
||||
|
||||
runs:
|
||||
using: 'composite' # Must be 'composite' for a custom composite action
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.20'
|
||||
- uses: actions/go-hashfiles@v0.0.1
|
||||
id: get-cache-hash
|
||||
with:
|
||||
patterns: |-
|
||||
**/package-lock.json
|
||||
- name: Cache dependencies
|
||||
id: cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}
|
||||
- name: Install dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
shell: bash # compared to workflow ymls... Action ymls require the 'shell' property when a 'run' property was used!
|
||||
@@ -1,5 +1,6 @@
|
||||
name: Deployment
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@@ -10,7 +11,12 @@ jobs:
|
||||
- name: Get code
|
||||
uses: actions/checkout@v3
|
||||
- name: Run our own Custom Composite Cached Node JS Deps Action
|
||||
uses: https://gitea.coursow.de/Test-Playground/actions-custom-composite
|
||||
id: custom
|
||||
uses: https://gitea.coursow.de/Test-Playground/actions-custom-composite@master
|
||||
with:
|
||||
caching: 'false' # Override the default 'caching' input value from the action.yml file for this step
|
||||
- name: Check Custom Action output
|
||||
run: echo "Used cache? --> ${{ steps.custom.outputs.cache-hit }}"
|
||||
- name: Lint code
|
||||
run: npm run lint
|
||||
test:
|
||||
@@ -19,7 +25,7 @@ jobs:
|
||||
- name: Get code
|
||||
uses: actions/checkout@v3
|
||||
- name: Run our own Custom Composite Cached Node JS Deps Action
|
||||
uses: https://gitea.coursow.de/Test-Playground/actions-custom-composite
|
||||
uses: https://gitea.coursow.de/Test-Playground/actions-custom-composite@master
|
||||
- name: Test code
|
||||
id: run-tests
|
||||
run: npm run test
|
||||
@@ -36,7 +42,7 @@ jobs:
|
||||
- name: Get code
|
||||
uses: actions/checkout@v3
|
||||
- name: Run our own Custom Composite Cached Node JS Deps Action
|
||||
uses: https://gitea.coursow.de/Test-Playground/actions-custom-composite
|
||||
uses: https://gitea.coursow.de/Test-Playground/actions-custom-composite@master
|
||||
- name: Build website
|
||||
run: npm run build
|
||||
- name: Package Artifacts
|
||||
|
||||
+32
-9
@@ -1,24 +1,47 @@
|
||||
#
|
||||
# To be able to use this action (with Gitea and Act Runner),
|
||||
# this action.yml file has to be placed in the root of the repository.
|
||||
# It is also important that a Git TAG is created (for example 'v1')
|
||||
# Then workflows can use this action like this:
|
||||
# 'using: https://gitea.coursow.de/Test-Playground/actions-custom-composite@v1'
|
||||
#
|
||||
|
||||
# Name and Description of the Action (Like displayed in GitHub Marketplace Overview)
|
||||
name: 'Get & Cache Dependencies'
|
||||
description: 'Get the Dependencies from the cache for a (npm) Node JS Project or initialize the cache for it'
|
||||
|
||||
# Inputs can be given with the 'with:' key later when using the custom action
|
||||
inputs:
|
||||
caching:
|
||||
description: 'If the cache should be used or not'
|
||||
required: false
|
||||
default: 'true'
|
||||
|
||||
outputs:
|
||||
cache-hit:
|
||||
description: 'Provides information if the cache was used during the action execution (true) or not (false)'
|
||||
value: ${{ steps.install.outputs.cache-hit }}
|
||||
|
||||
runs:
|
||||
using: 'composite' # Must be 'composite' for a custom composite action
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.20'
|
||||
- uses: actions/go-hashfiles@v0.0.1
|
||||
- uses: KEINOS/gh-action-hash-for-cache@v2.0.0-alpha
|
||||
id: get-cache-hash
|
||||
with:
|
||||
patterns: |-
|
||||
**/package-lock.json
|
||||
if: inputs.caching == 'true'
|
||||
with:
|
||||
path: |
|
||||
package-lock.json
|
||||
- name: Cache dependencies
|
||||
id: cache
|
||||
if: inputs.caching == 'true'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}
|
||||
- name: Install dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
id: install
|
||||
if: steps.cache.outputs.cache-hit != 'true' || inputs.caching != 'true'
|
||||
run: |
|
||||
npm ci
|
||||
echo "cache-hit='true'" >> $GITHUB_OUTPUT
|
||||
shell: bash # compared to workflow ymls... Action ymls require the 'shell' property when a 'run' property was used!
|
||||
Reference in New Issue
Block a user