Skip to content

Commit

Permalink
Merge pull request #17 from senz/reusable-workflow-2
Browse files Browse the repository at this point in the history
reusable workflow 2
  • Loading branch information
senz authored Feb 26, 2024
2 parents 18555ec + b35319f commit ff32b2f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/test-data/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# yaml-language-server: $schema=https://github.com/senz/cheatsheet-generator/raw/ea65c9e8b3d436d33fe3b0a69e5c89cf044df464/build-schema.json
# yaml-language-server: $schema=https://github.com/senz/cheatsheet-generator/raw/master/build-schema.json
---
include:
- config: config.example.yml
Expand Down
39 changes: 25 additions & 14 deletions .github/workflows/build-user-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
build_matrix_path:
description: "Path to the build matrix file"
default: "build.yaml"
default: "cheatsheet-build.yaml"
required: false
type: string
config_path:
Expand All @@ -15,7 +15,7 @@ on:
type: string
archive_name:
description: "Archive output file name"
default: "cheatsheet"
default: "cheatsheets"
required: false
type: string

Expand Down Expand Up @@ -76,29 +76,40 @@ jobs:
# cp -R ${{ inputs.config_path }}/* "${{ env.base_dir }}/${{ inputs.config_path }}/"
# fi

- uses: actions/setup-node@v4
with:
node-version: 20.11.1
cache: npm
cache-dependency-path: ${{ env.base }}/package-lock.json

- name: Checkout Cheatsheet
uses: actions/checkout@v4
with:
repository: senz/cheatsheet-generator
path: ${{ env.cheatsheet_dir }}
# ref: ${{ env.ch_version }}

# ref: ${{ env.ch_version }}

- uses: actions/setup-node@v4
with:
node-version: 20.11.1
cache: npm
cache-dependency-path: ${{ env.cheatsheet_dir }}/package-lock.json

- name: symlink config
working-directory: ${{ env.base_dir }}
run: |
ln -sv "${{ inputs.config_path }}/${{ env.config_file_name }}" "${{ env.cheatsheet_dir }}/config.yml"
- run: npm ci
ln -sv "${GITHUB_WORKSPACE}/${{ inputs.config_path }}/${{ env.config_file_name }}" "${{ env.cheatsheet_dir }}/config.yml"
- name: Debug config
working-directory: ${{ env.base_dir }}
if: ${{ runner.debug }}
run: |
ls -l "${GITHUB_WORKSPACE}/${{ inputs.config_path }}/${{ env.config_file_name }}"
ls -l "${{ env.cheatsheet_dir }}/config.yml"
ls -l "${GITHUB_WORKSPACE}/${{ inputs.config_path }}/"
ls -l "${{ env.cheatsheet_dir }}"
- run: npm ci
working-directory: ${{ env.cheatsheet_dir }}

- run: npm run build
working-directory: ${{ env.base_dir }}
env:
NODE_OPTIONS: "--openssl-legacy-provider"
working-directory: ${{ env.cheatsheet_dir }}

- name: Archive (${{ env.config_name }})
uses: actions/upload-artifact@v4
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/config-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@ on:
permissions: read-all
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run build-user-config workflow
uses: ./.github/workflows/build-user-config.yml
with:
build_matrix_path: .github/test-data/build.yaml
config_path: .github/test-data/config
archive_name: example-cheatsheet
uses: ./.github/workflows/build-user-config.yml
with:
build_matrix_path: .github/test-data/build.yaml
config_path: .github/test-data/config
archive_name: example-cheatsheet

0 comments on commit ff32b2f

Please sign in to comment.