Skip to content

Pin Node.js

Pin Node.js #1886

Workflow file for this run

name: ci&cd
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 26
- name: find pnpm cache path
id: cache
run: echo "path=$(pnpm store path)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ steps.cache.outputs.path }}
key: v1-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
v1-pnpm-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- run: node --run lint
- run: node --run lint:fmt
typecheck:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 26
- name: find pnpm cache path
id: cache
run: echo "path=$(pnpm store path)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ steps.cache.outputs.path }}
key: v1-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
v1-pnpm-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- run: node --run typecheck
test:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 26
- name: find pnpm cache path
id: cache
run: echo "path=$(pnpm store path)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ steps.cache.outputs.path }}
key: v1-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
v1-pnpm-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- run: node --run test
env:
NODE_ENV: test
build:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw,value={{sha}}
type=raw,value=latest
- name: Login to GHCR
if: github.ref == 'refs/heads/main'
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and maybe Push Docker image
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
#cache-from: type=gha
#cache-to: type=gha,mode=max
deploy:
if: github.ref == 'refs/heads/main'
needs: [lint, test, typecheck, build]
runs-on: ubuntu-slim
environment:
name: prod
url: https://arm.haglund.dev/api
steps:
- run: echo 'Deployed! :)'