53 lines
1.6 KiB
YAML
53 lines
1.6 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [22.12.0]
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: "npm"
|
|
- run: npm install
|
|
- run: npm run build --if-present
|
|
|
|
docker:
|
|
needs: [build]
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
|
|
env:
|
|
IMAGE_TAG: ${{ github.ref_name == 'main' && 'latest' || 'dev' }}
|
|
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/frontend-hideyoshi.com:latest
|
|
permissions:
|
|
contents: read
|
|
packages: write # required to push to ghcr.io
|
|
id-token: write # optional for OIDC if you use it
|
|
|
|
steps:
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build image
|
|
run: docker build -t $IMAGE_NAME .
|
|
|
|
- name: Push image
|
|
run: docker push $IMAGE_NAME
|