Skip to content

Commit

Permalink
switch to building docker image and publishing to ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
elrayle committed Jan 17, 2024
1 parent fcd5835 commit ada67f6
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions .github/workflows/build_and_deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,37 @@ on:
branches:
- elr/gh-action-dev-deploy

env:
AZURE_WEBAPP_NAME: clearlydefined-api-dev
# AZURE_WEBAPP_PACKAGE_PATH: '.' # TODO: confirm that root is the webapp root (default is root)
NODE_VERSION: '18' # TODO: does this need to have a minor version?
# env:
# AZURE_WEBAPP_NAME: clearlydefined-api-dev
# # AZURE_WEBAPP_PACKAGE_PATH: '.' # TODO: confirm that root is the webapp root (default is root)
# NODE_VERSION: '18' # TODO: does this need to have a minor version?

jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
- uses: actions/checkout@v4

- name: Log into ghcr registry
uses: docker/login-action@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: npm install, build, and test
run: |
# Build and test the project, then
# deploy to Azure Web App.
npm install
npm run build --if-present
npm run test --if-present
# working-directory: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} # TODO: uncomment if determined that root is not the webapp root
- name: 'Deploy to Azure WebApp'
uses: azure/webapps-deploy@v2
registry: ghcr.io
username: ${{ github.actor }} # GitHub username of person launching the action
password: ${{ secrets.GITHUB_TOKEN }} # 24-hour token starting from the time the job is run

- name: Build and push image
uses: docker/build-push-action@v5
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
# package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} # TODO: uncomment if determined that root is not the webapp root
context: .
file: DevDockerfile
tags: |
service-dev:latest
service-dev:${{ github.sha }}
# - name: 'Deploy to Azure WebApp'
# uses: azure/webapps-deploy@v2
# with:
# app-name: ${{ env.AZURE_WEBAPP_NAME }}
# publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
# # package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} # TODO: uncomment if determined that root is not the webapp root

0 comments on commit ada67f6

Please sign in to comment.