Change workflow

This commit is contained in:
Fergal Moran
2023-03-06 17:28:18 +00:00
parent 64e1ed1f86
commit e9bfc398ce
3 changed files with 28 additions and 19 deletions

View File

@@ -4,25 +4,35 @@ on:
push: push:
branches: [ develop ] branches: [ develop ]
defaults:
run:
working-directory: scheduler
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - name: Build image
with: run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
registry: ghcr.io
username: ${{ github.actor }} - name: Log in to registry
password: ${{ secrets.GITHUB_TOKEN }} run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 - name: Push image
- name: Build and push run: |
uses: docker/build-push-action@v2 IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
with:
context: ./scheduler # Change all uppercase to lowercase
tags: ${{ steps.meta.outputs.tags }} IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
labels: ${{ steps.meta.outputs.labels }} # Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION

View File

@@ -4,7 +4,6 @@ import { NextApiRequest, NextApiResponse } from "next";
import { firebaseConfig } from "@/lib/db"; import { firebaseConfig } from "@/lib/db";
const handler = async (req: NextApiRequest, res: NextApiResponse) => { const handler = async (req: NextApiRequest, res: NextApiResponse) => {
res.status(StatusCodes.OK).json(process.env); res.status(StatusCodes.OK).json(process.env);
res.end(); res.end();
}; };