From c705cc093221e7ca4a748d97b02529bdf34df5e0 Mon Sep 17 00:00:00 2001 From: Noah Spannbauer Date: Tue, 21 May 2024 16:32:07 -0500 Subject: [PATCH 1/2] adding github actions workflows --- .github/workflows/feature.yml | 29 +++++++++++++++++++++ .github/workflows/pull_request.yml | 42 ++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/feature.yml create mode 100644 .github/workflows/pull_request.yml diff --git a/.github/workflows/feature.yml b/.github/workflows/feature.yml new file mode 100644 index 0000000..30ba72a --- /dev/null +++ b/.github/workflows/feature.yml @@ -0,0 +1,29 @@ +name: Feature + +on: + push: + branches: + - feature/** + +jobs: + build_and_deploy_job: + runs-on: ubuntu-latest + name: Build and Deploy Job + steps: + - uses: actions/checkout@v4 + 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 }} + repo_token: ${{ secrets.GITHUB_TOKEN }} + action: "upload" + app_location: "/" + app_build_command: 'npm run build-storybook' + api_location: "" + output_location: "storybook-static" + deployment_environment: "development" + \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..c6b765e --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,42 @@ +name: Pull Request + +on: + pull_request: + types: [opened, synchronize, reopened, closed] + branches: + - main + +jobs: + build_and_deploy_job: + if: github.event_name == 'pull_request' && github.event.action != 'closed' + runs-on: ubuntu-latest + name: Build and Deploy Job + steps: + - uses: actions/checkout@v4 + with: + submodules: true + lfs: false + - 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 }} + repo_token: ${{ secrets.GITHUB_TOKEN }} + action: 'upload' + app_location: '/' + app_build_command: 'npm run build-storybook' + api_location: '' + output_location: 'storybook-static' + deployment_environment: 'staging' + + 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: 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' \ No newline at end of file -- 2.49.1 From 095f3d0e3d61a60bc0c620a9628dfcd52bcd96c2 Mon Sep 17 00:00:00 2001 From: Noah Spannbauer Date: Tue, 21 May 2024 17:20:02 -0500 Subject: [PATCH 2/2] Updating github actions app and api build commands and locations --- .github/workflows/feature.yml | 9 +++++---- .github/workflows/pull_request.yml | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/feature.yml b/.github/workflows/feature.yml index 30ba72a..5629c65 100644 --- a/.github/workflows/feature.yml +++ b/.github/workflows/feature.yml @@ -21,9 +21,10 @@ jobs: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }} action: "upload" - app_location: "/" - app_build_command: 'npm run build-storybook' - api_location: "" - output_location: "storybook-static" + app_build_command: ${{ vars.APP_BUILD_COMMAND }} + app_location: ${{ vars.APP_LOCATION }} + api_build_command: ${{ vars.API_BUILD_COMMAND }} + api_location: ${{ vars.API_LOCATION}} + output_location: ${{ vars.OUTPUT_LOCATION }} deployment_environment: "development" \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c6b765e..7940875 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -23,10 +23,11 @@ jobs: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }} action: 'upload' - app_location: '/' - app_build_command: 'npm run build-storybook' - api_location: '' - output_location: 'storybook-static' + app_build_command: ${{ vars.APP_BUILD_COMMAND }} + app_location: ${{ vars.APP_LOCATION }} + api_build_command: ${{ vars.API_BUILD_COMMAND }} + api_location: ${{ vars.API_LOCATION}} + output_location: ${{ vars.OUTPUT_LOCATION }} deployment_environment: 'staging' close_pull_request_job: -- 2.49.1