Skip to content

use remote fields config #30

use remote fields config

use remote fields config #30

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- 'main'
env:
DOCKERHUB_IMAGE: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: 'Create .env.local'
run: |
echo NEXT_PUBLIC_ROOT_DOMAIN=portal-staging.bolselkab.go.id >> .env.local
echo BACKEND_URL=${{ secrets.BACKEND_URL }} >> .env.local
echo BACKEND_TOKEN=${{ secrets.BACKEND_TOKEN }} >> .env.local
echo NEW_RELIC_APP_NAME=${{ secrets.NEW_RELIC_APP_NAME }} >> .env.local
echo NEW_RELIC_LICENSE_KEY=${{ secrets.NEW_RELIC_LICENSE_KEY }} >> .env.local
echo NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID=${{ secrets.NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID }} >> .env.local
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Extract metadata for Docker image
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.DOCKERHUB_IMAGE }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to Docker Hub
uses: docker/login-action@v2
if: env.DOCKERHUB_IMAGE
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# Temp fix:
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache