Skip to content

Commit d1b3799

Browse files
committed
feat: simplify jobs in workflow
1 parent 853fc8e commit d1b3799

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

Diff for: .github/workflows/azure-static-web-app.yml

+2-29
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,11 @@ jobs:
2828
name: build
2929
path: output.tar.gz
3030

31-
deploy-pr:
32-
if: github.event_name == 'pull_request'
31+
deploy:
3332
runs-on: ubuntu-latest
3433
needs: build
3534
environment:
36-
name: pr
37-
url: ${{ steps.deploy.outputs.url }}
38-
steps:
39-
- name: download build artifact
40-
uses: actions/download-artifact@v3
41-
with:
42-
name: build
43-
- name: extract output
44-
run: tar -xzf output.tar.gz
45-
- name: install swa cli
46-
run: npm install -g @azure/static-web-apps-cli
47-
- name: deploy app
48-
id: deploy
49-
run: |
50-
# deploy site with swa
51-
set -o pipefail
52-
swa deploy ./out --deployment-token ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} \
53-
--env ${{ github.event_name == 'pull_request' && 'preview' || 'production' }} 2>&1 | tee deploy.log
54-
url=$(grep 'Project deployed to' deploy.log | awk '{print $5}' | sed 's/\x1b\[[0-9;]*m//g')
55-
echo "url=$url" >> "$GITHUB_OUTPUT"
56-
57-
deploy-production:
58-
if: github.event_name != 'pull_request'
59-
runs-on: ubuntu-latest
60-
needs: build
61-
environment:
62-
name: dev
35+
name: ${{ github.event_name == 'pull_request' && 'pr' || 'dev' }}
6336
url: ${{ steps.deploy.outputs.url }}
6437
steps:
6538
- name: download build artifact

0 commit comments

Comments
 (0)