chore: release 0.20.0 (#172) #193
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Azure Static Web Apps CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: | |
- main | |
jobs: | |
clean: | |
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && github.event.action != 'closed' | |
runs-on: ubuntu-latest | |
name: Delete old bot comment | |
steps: | |
- name: pr-deleter | |
uses: maheshrayas/action-pr-comment-delete@06d7254b4aeba4491a66a7e0f755b107f7373ccd | |
with: | |
github_token: '${{ secrets.GITHUB_TOKEN }}' | |
org: 'geoffrich' | |
repo: 'svelte-adapter-azure-swa' | |
user: 'github-actions[bot]' | |
issue: '${{github.event.number}}' | |
build_and_deploy_job: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && github.event.action != 'closed') | |
runs-on: ubuntu-latest | |
name: Build and Deploy Job | |
env: | |
# workaround for Oryx issue: see https://github.com/Azure/static-web-apps/issues/909#issuecomment-1320077142 | |
CUSTOM_BUILD_COMMAND: 'chown -R root:root . && npm install --unsafe-perm && npm run build' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Build And Deploy | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_DESERT_00B80111E }} | |
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: '/demo' # App source code path | |
api_location: 'demo/func' # Api source code path - optional | |
output_location: 'build/static' # Built app content directory - optional | |
# needed when we set CUSTOM_BUILD_COMMAND | |
skip_api_build: true | |
###### End of Repository/Build Configurations ###### | |
outputs: | |
preview_url: ${{ steps.builddeploy.outputs.static_web_app_url }} | |
test: | |
needs: build_and_deploy_job | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && github.event.action != 'closed') | |
name: Run E2E Tests | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: demo | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright | |
run: npx playwright install chromium --with-deps | |
- name: Run Playwright tests | |
run: npm test | |
env: | |
PLAYWRIGHT_TEST_BASE_URL: ${{ needs.build_and_deploy_job.outputs.preview_url }} | |
close_pull_request_job: | |
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
name: Close Pull Request Job | |
steps: | |
- 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_POLITE_DESERT_00B80111E }} | |
action: 'close' |