Skip to content

Updated login to be redirect (#49) #88

Updated login to be redirect (#49)

Updated login to be redirect (#49) #88

name: React App Tabs to Test
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
environment: Test
name: Build and Deploy Job
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Run preinstall script
run: npx npm-force-resolutions
- name: Install dependencies
run: npm install
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
env:
CI: false
REACT_APP_LNBITS_NODE_URL: ${{ secrets.LNBITS_NODE_URL }}
REACT_APP_LNBITS_USERNAME: ${{ secrets.LNBITS_USERNAME }}
REACT_APP_LNBITS_PASSWORD: ${{ secrets.LNBITS_PASSWORD }}
REACT_APP_LNBITS_ADMINKEY: ${{ secrets.LNBITS_ADMINKEY }}
REACT_APP_LNBITS_STORE_ID: ${{ secrets.LNBITS_STORE_ID }}
REACT_APP_TENANT_ID: ${{ secrets.TENANT_ID }}
REACT_APP_AAD_CLIENT_ID: ${{ secrets.AAD_CLIENT_ID }}
REACT_APP_LNBITS_STORE_OWNER_EMAIL: ${{ secrets.LNBITS_STORE_OWNER_EMAIL }}
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: 'upload'
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: '/tabs' # App source code path
api_location: '' # Api source code path - optional
output_location: 'build' # Built app content directory - optional
###### End of Repository/Build Configurations ######
- name: Install Azure CLI
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Azure Login
run: az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
- name: Add Redirect URI
if: github.event_name == 'pull_request'
run: |
az ad app update --id 9b80eb43-d75a-43e3-8104-0d6d0f0b41ec --add web.redirectUris ${{ steps.builddeploy.outputs.deploymentUrl }}
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Remove Redirect URI
run: |
az ad app update --id 9b80eb43-d75a-43e3-8104-0d6d0f0b41ec --remove web.redirectUris ${{ steps.builddeploy.outputs.deploymentUrl }}
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: 'close'
app_location: '/tabs'