feat: add namespace #6
Workflow file for this run
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: Build & Push Docker Image | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: 'Create env file' | |
run: | | |
touch app/.env.production | |
echo NODE_ENV=production >> app/.env.production | |
echo SECRET=${{ secrets.SECRET }} >> app/.env.production | |
echo DB_NAME=${{ secrets.DB_NAME }} >> app/.env.production | |
echo MONGO_URI=${{ secrets.MONGO_URI }} >> app/.env.production | |
echo FIREBASE_SERVICE_ACCOUNT_KEY=${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }} >> app/.env.production | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: app | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/horpakjs:v1.${{ github.run_number }} | |
- name: 'Delete env file' | |
run: | | |
rm app/.env.production | |
- name: 'Trigger manifest repo' | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{secrets.GIT_TOKEN}}"\ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/hongjs/horpak-nextjs-manifest/actions/workflows/pipeline.yml/dispatches \ | |
-d '{"ref":"main", "inputs":{"DOCKER_TAG":"v1.${{ github.run_number }}"}}' |