Skip to content

Commit 83eb686

Browse files
committed
fix: attempt 5 to fix CI/CD. Also lints yaml files.
1 parent ddea323 commit 83eb686

File tree

3 files changed

+35
-29
lines changed

3 files changed

+35
-29
lines changed

.github/workflows/deploy.yml

+16-10
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,32 @@ jobs:
2727
# Build job
2828
build:
2929
runs-on: ubuntu-latest
30-
defaults:
31-
run:
32-
working-directory: react
3330
steps:
3431
- name: Checkout
3532
uses: actions/checkout@v4
36-
with:
37-
sparse-checkout: react
33+
with:
34+
sparse-checkout: react
35+
- name: Change Directory to React Folder
36+
run: cd ./react/
37+
- name: Check yarn.lock Exist
38+
id: check_yarn
39+
uses: thebinaryfelix/check-file-existence-action@v1
40+
with:
41+
files: 'yarn.lock'
42+
- name: Check package.json Exist
43+
id: check_package
44+
uses: thebinaryfelix/check-file-existence-action@v1
45+
with:
46+
files: 'package.json'
3847
- name: Detect package manager
3948
id: detect-package-manager
40-
41-
# Old-1: if [ -f "${{ github.workspace }}/yarn.lock" ]; then
42-
# Old-2: elif [ -f "${{ github.workspace }}/package.json" ]; then
4349
run: |
44-
if [ ${{ hashFiles('**/yarn.lock') != '' }} ] then
50+
if ${{ steps.check_yarn.outputs.exists == 'true' }} then
4551
echo "manager=yarn" >> $GITHUB_OUTPUT
4652
echo "command=install" >> $GITHUB_OUTPUT
4753
echo "runner=yarn" >> $GITHUB_OUTPUT
4854
exit 0
49-
elif [ ${{ hashFiles('**/package.json') != '' }} ] then
55+
if ${{ steps.check_package.outputs.exists == 'true' }} then
5056
echo "manager=npm" >> $GITHUB_OUTPUT
5157
echo "command=ci" >> $GITHUB_OUTPUT
5258
echo "runner=npx --no-install" >> $GITHUB_OUTPUT

.github/workflows/nextjs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
build:
3131
runs-on: ubuntu-latest
3232
defaults:
33-
run:
33+
run:
3434
working-directory: react
3535
steps:
3636
- name: Checkout
@@ -89,7 +89,7 @@ jobs:
8989
# Deployment job
9090
deploy:
9191
defaults:
92-
run:
92+
run:
9393
working-directory: react
9494
environment:
9595
name: github-pages

.github/workflows/validate.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Validate-YAML
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
paths: ['.github/**']
77
pull_request:
8-
branches: [ main ]
8+
branches: [main]
99
paths: ['.github/**']
1010

1111
workflow_dispatch:
@@ -14,22 +14,22 @@ jobs:
1414
validate-yaml:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v4
19-
with:
20-
sparse-checkout: .github
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
sparse-checkout: .github
2121

22-
- name: Validate YAML files
23-
id: lint
24-
uses: ibiqlik/action-yamllint@v3
22+
- name: Validate YAML files
23+
id: lint
24+
uses: ibiqlik/action-yamllint@v3
2525

26-
- name: Echo Lint Result
27-
if: always()
28-
run: echo ${{ steps.lint.outputs.logfile }}
26+
- name: Echo Lint Result
27+
if: always()
28+
run: echo ${{ steps.lint.outputs.logfile }}
2929

30-
- name: Output Logfile
31-
uses: actions/upload-artifact@v4
32-
if: always()
33-
with:
30+
- name: Output Logfile
31+
uses: actions/upload-artifact@v4
32+
if: always()
33+
with:
3434
name: yamllint-logfile
35-
path: ${{ steps.lint.outputs.logfile }}
35+
path: ${{ steps.lint.outputs.logfile }}

0 commit comments

Comments
 (0)