Skip to content

Commit 9ec7ded

Browse files
authored
Add GitHub action workflow for publishing OData org website to production (OData#353)
* Add GitHub action workflow for publishing OData org website to production * Production and staging workflows to publish site should be triggered manually
1 parent bb7aee4 commit 9ec7ded

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
2+
# More on GitHub Actions for Azure: https://github.com/Azure/actions
3+
# More on GitHub Action for Azure Login: https://github.com/azure/login#github-action-for-azure-login
4+
5+
name: Publish OData org website to Azure Web App production slot
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
workflow_dispatch: # Makes it possible to trigger workflow manually
12+
13+
jobs:
14+
publish:
15+
if: github.repository_owner == 'OData' && github.event_name == 'workflow_dispatch'
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
with:
21+
lfs: true # Forces LFS files (images in our case) to be checked out
22+
submodules: 'recursive' # Check out submodules if applicable
23+
24+
- name: Build the site in a jekyll/builder container
25+
run: |
26+
docker run \
27+
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \
28+
jekyll/builder:stable /bin/bash -c "chmod -R 777 /srv/jekyll && jekyll build --future"
29+
30+
- name: Log in with Azure # Using Azure Service Principal
31+
uses: azure/login@v1
32+
with:
33+
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
34+
35+
- name: Deploy to Azure Web App
36+
uses: azure/webapps-deploy@v2
37+
with:
38+
app-name: 'odata-prod'
39+
package: ${{ github.workspace }}/_site

.github/workflows/publish_to_staging_slot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

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

1818
steps:

0 commit comments

Comments
 (0)