Skip to content

Commit

Permalink
Merge pull request #3 from nickwph/test-node-version
Browse files Browse the repository at this point in the history
Able to handle older node versions.
  • Loading branch information
nickwph authored Dec 14, 2023
2 parents 36f77ca + a986878 commit 4911514
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,45 @@ jobs:
app: ${{ secrets.FIREBASE_APP_ID }}
credentials: ${{ secrets.FIREBASE_CREDENTIALS }}
cache: false
test-node-version-16:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '16.x'
- name: Run nickwph/firebase-app-distribution-action@v1
uses: ./
with:
file: .github/workflows/assets/app-debug.apk
app: ${{ secrets.FIREBASE_APP_ID }}
credentials: ${{ secrets.FIREBASE_CREDENTIALS }}
cache: false
test-node-version-18:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Run nickwph/firebase-app-distribution-action@v1
uses: ./
with:
file: .github/workflows/assets/app-debug.apk
app: ${{ secrets.FIREBASE_APP_ID }}
credentials: ${{ secrets.FIREBASE_CREDENTIALS }}
cache: false
test-node-version-21:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '21.x'
- name: Run nickwph/firebase-app-distribution-action@v1
uses: ./
with:
file: .github/workflows/assets/app-debug.apk
app: ${{ secrets.FIREBASE_APP_ID }}
credentials: ${{ secrets.FIREBASE_CREDENTIALS }}
cache: false
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ inputs:
runs:
using: composite
steps:
- name: Checking node version
id: node-version-above-18
shell: bash
run: bash etc/compare-node-version.sh
continue-on-error: true
- uses: actions/setup-node@v4
if: ${{ steps.node-version-above-18.conclusion == 'failure' }}
with:
node-version: '18.x'
- uses: actions/cache@v3
if: ${{ inputs.cache == 'true' }}
env: { cache-name: firebase-app-distribution-action }
Expand Down
10 changes: 10 additions & 0 deletions etc/compare-node-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
nodever="$(node --version)"
currentver="${nodever:1}"
requiredver="18.0.0"
if [ "$(printf '%s\n' "$requiredver" "$currentver" | sort -V | head -n1)" = "$requiredver" ]; then
exit 0
else
echo "Current NodeJS version is v${currentver}, which is lower than required version v${requiredver}"
exit 1
fi

0 comments on commit 4911514

Please sign in to comment.