Update CI #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- uses: pnpm/action-setup@v4 | |
- id: get-store-path | |
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.get-store-path.outputs.STORE_PATH }} | |
key: pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | |
restore-keys: | | |
pnpm-store- | |
pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.next/cache | |
key: nextjs-${{ hashFiles('pnpm-lock.yaml') }} | |
restore-keys: | | |
nextjs- | |
nextjs-${{ hashFiles('pnpm-lock.yaml') }} | |
- name: Install | |
run: pnpm install --frozen-lockfile | |
- name: Lint | |
run: pnpm lint | |
- name: Build | |
run: pnpm build | |
deploy: | |
needs: [check] | |
runs-on: ubuntu-latest | |
env: | |
USERNAME: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CONTAINER_NAME: blog | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login into registry | |
run: echo $GITHUB_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin | |
- name: Build Docker image | |
run: docker build -t ghcr.io/${{ github.repository }}/$CONTAINER_NAME:latest . | |
- name: Push to registry | |
run: docker push ghcr.io/${{ github.repository }}/$CONTAINER_NAME:latest |