Skip to content

Commit

Permalink
Add GitHub action workflow for publishing OData org website to produc…
Browse files Browse the repository at this point in the history
…tion (#353)

* Add GitHub action workflow for publishing OData org website to production
* Production and staging workflows to publish site should be triggered manually
  • Loading branch information
gathogojr authored Aug 10, 2023
1 parent bb7aee4 commit 9ec7ded
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/workflows/publish_to_production_slot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More on GitHub Actions for Azure: https://github.com/Azure/actions
# More on GitHub Action for Azure Login: https://github.com/azure/login#github-action-for-azure-login

name: Publish OData org website to Azure Web App production slot

on:
push:
branches:
- master
workflow_dispatch: # Makes it possible to trigger workflow manually

jobs:
publish:
if: github.repository_owner == 'OData' && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
lfs: true # Forces LFS files (images in our case) to be checked out
submodules: 'recursive' # Check out submodules if applicable

- name: Build the site in a jekyll/builder container
run: |
docker run \
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \
jekyll/builder:stable /bin/bash -c "chmod -R 777 /srv/jekyll && jekyll build --future"
- name: Log in with Azure # Using Azure Service Principal
uses: azure/login@v1
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'

- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: 'odata-prod'
package: ${{ github.workspace }}/_site
2 changes: 1 addition & 1 deletion .github/workflows/publish_to_staging_slot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
publish:
if: github.repository_owner == 'OData' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'workflow_dispatch')
if: github.repository_owner == 'OData' && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest

steps:
Expand Down

0 comments on commit 9ec7ded

Please sign in to comment.