Skip to content

Commit

Permalink
chore: update github action
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Apr 2, 2024
1 parent 4c9d899 commit 183023a
Showing 1 changed file with 15 additions and 26 deletions.
41 changes: 15 additions & 26 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,31 @@ name: Node.js CI

on: [push]
jobs:
node_version:
runs-on: ubuntu-latest
outputs:
NODE_VERSION: ${{ steps.node_version.outputs.NODE_VERSION }}
steps:
- uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc |cut -c2-8)

build:
needs: [node_version]
runs-on: ubuntu-latest
strategy:
matrix:
step: ["lint:check", "format:check", "build", "test:docker"]
steps:
- uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc |cut -c2-8)
- uses: actions/checkout@v4

- name: Use Node.js ${{ needs.node_version.outputs.NODE_VERSION }}
uses: actions/setup-node@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ needs.node_version.outputs.NODE_VERSION }}
node-version-file: .nvmrc
cache: "yarn"

- name: Install dependencies
run: yarn

# Build Typescript
- run: |
yarn
yarn ${{ matrix.step }}
- name: Run ${{ matrix.step }}
run: yarn ${{ matrix.step }}
env:
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
STRIPE_WEBHOOK_SECRET: ${{ secrets.STRIPE_WEBHOOK_SECRET }}

push:
needs: [node_version, build]
needs: [build]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
permissions:
Expand All @@ -44,7 +35,7 @@ jobs:
checks: write
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Build and push container image to GCR (only on main branch)
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v1
Expand All @@ -57,8 +48,6 @@ jobs:
uses: docker/build-push-action@v4
with:
push: true
build-args: |
NODE_VERSION=${{ needs.node_version.outputs.NODE_VERSION }}
tags: |
ghcr.io/ardriveapp/${{ github.event.repository.name }}:latest
ghcr.io/ardriveapp/${{ github.event.repository.name }}:${{ github.sha }}

0 comments on commit 183023a

Please sign in to comment.