Skip to content

Astro support POC #1113

Astro support POC

Astro support POC #1113

Workflow file for this run

name: Test and publish
on:
push:
branches:
- main
paths-ignore:
- "**/*.md"
pull_request:
branches:
- "**"
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
if: ${{ github.base_ref }}
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
check-latest: false
- name: node_modules cache
uses: actions/cache@v3
id: node_modules_cache
with:
path: ./node_modules
key: ${{ runner.os }}-20-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-20-
- name: Install deps
if: steps.node_modules_cache.outputs.cache-hit != 'true'
run: npm ci
- name: Build
run: npm run build
- name: "Upload Artifact"
uses: actions/upload-artifact@v3
with:
path: |
packages/*/dist/
packages/@apphosting/*/dist/
retention-days: 1
if-no-files-found: ignore
test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
node: [18, 20]
fail-fast: false
name: Test Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
if: ${{ github.base_ref }}
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
check-latest: true
- name: node_modules cache
id: node_modules_cache
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node }}-
- name: Install deps
if: steps.node_modules_cache.outputs.cache-hit != 'true'
run: npm ci
- name: Firebase emulator cache
uses: actions/cache@v3
with:
path: ~/.cache/firebase/emulators
key: firebase_emulators
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Rsync Artifacts
run: rsync -a artifact/ packages
- name: Test
run: npm run test
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
check-latest: true
- name: node_modules cache
id: node_modules_cache
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-20-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-20-
- name: Install deps
if: steps.node_modules_cache.outputs.cache-hit != 'true'
run: npm ci
- name: Test
run: npm run lint:quiet
# Break the branch protection test into a separate step, so we can manage the matrix more easily
test_and_contribute:
runs-on: ubuntu-latest
name: Branch protection
needs: ["test", "lint"]
steps:
- run: true
publish:
runs-on: ubuntu-latest
name: Publish (NPM)
needs: ["build", "test"]
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
check-latest: false
registry-url: "https://registry.npmjs.org"
- name: "Download Artifacts"
uses: actions/download-artifact@v3
- name: Rsync Artifacts
run: rsync -a artifact/ packages
- name: Publish
run: npm run publish
env:
ADAPTER_NEXTJS_NPM_TOKEN: ${{ secrets.ADAPTER_NEXTJS_NPM_TOKEN }}
ADAPTER_ANGULAR_NPM_TOKEN: ${{ secrets.ADAPTER_ANGULAR_NPM_TOKEN }}
# FIREBASE_FRAMEWORKS_NPM_TOKEN: ${{ secrets.FIREBASE_FRAMEWORKS_NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_NPM_TOKEN }}