#123, #128, feat(404-page), feat(app): created CI pipeline using github actions #1
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 Pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Run tests | |
run: npm test | |
- name: Build Next.js app | |
run: npm run build | |
build-docker: | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
container: | |
image: gcr.io/kaniko-project/executor:latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Kaniko Configuration | |
run: | | |
mkdir -p /kaniko/.docker | |
echo '{ | |
"auths": { | |
"${{ secrets.REGISTRY_URL }}": { | |
"username": "${{ secrets.REGISTRY_USERNAME }}", | |
"password": "${{ secrets.REGISTRY_PASSWORD }}" | |
} | |
} | |
}' > /kaniko/.docker/config.json | |
- name: Build and Push Docker Image | |
run: | | |
/kaniko/executor \ | |
--context . \ | |
--dockerfile ./Dockerfile \ | |
--destination ${{ secrets.REGISTRY_URL }}/my-app:${{ github.sha }} |