Skip to content

Commit 4c862a2

Browse files
committed
e
1 parent a594690 commit 4c862a2

File tree

1 file changed

+4
-46
lines changed

1 file changed

+4
-46
lines changed

.github/workflows/build-website.yml

+4-46
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
tags:
99
- "v[0-9]+.[0-9]+.[0-9]+"
1010
branches:
11+
- main
1112
- "staging**"
1213
workflow_dispatch:
1314

@@ -27,52 +28,9 @@ jobs:
2728
steps:
2829
- uses: actions/checkout@v4
2930

30-
- run: echo "nvmrc=$(cat .nvmrc)" >> $GITHUB_ENV
31-
id: nvmrc
31+
- run: echo ${{ startsWith(github.ref, 'refs/tags/') }}
3232

33-
- uses: actions/setup-node@v4
34-
with:
35-
node-version: "${{ env.nvmrc }}"
36-
cache: npm
37-
38-
- run: npm ci
39-
40-
- run: echo "APP_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
41-
id: APP_VERSION
42-
43-
- run: echo "BRANCH=$([[ "$(git branch --show-current)" == "main" ]] && echo "dist" || echo "staging/dist")" >> $GITHUB_ENV
33+
- run: echo "BRANCH=$(${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' }} && echo "dist" || echo "staging/dist")" >> $GITHUB_ENV
4434
id: BRANCH
4535

46-
- run: echo "SENTRY_ENVIRONMENT=$([[ "${{ env.BRANCH }}" == "dist" ]] && echo "production" || echo "staging")" >> $GITHUB_ENV
47-
id: SENTRY_ENVIRONMENT
48-
49-
- env:
50-
DOMAIN: "${{ secrets.DOMAIN }}"
51-
run: sed -i "s/\$DOMAIN/${{ env.DOMAIN }}/" index.html
52-
53-
- env:
54-
ENVIRONMENT: "${{ env.SENTRY_ENVIRONMENT }}"
55-
APP_VERSION: "${{ env.APP_VERSION }}"
56-
DOMAIN: "${{ secrets.DOMAIN }}"
57-
SENTRY_INGEST: "${{ secrets.SENTRY_INGEST }}"
58-
PLAUSIBLE_API_URL: "${{ secrets.PLAUSIBLE_API_URL }}"
59-
PB_INSTANCES: "${{ secrets.PB_INSTANCES }}"
60-
run: npm run build
61-
62-
- run: |
63-
git checkout index.html
64-
[[ "${{ env.BRANCH }}" != "dist" ]] && git fetch && git branch main remotes/origin/main
65-
git switch --orphan ${{ env.BRANCH }}
66-
git checkout main netlify.toml
67-
git add docs
68-
git config user.name "Zwyx - GitHub Actions"
69-
git config user.email "[email protected]>"
70-
git commit -m "Build website"
71-
git push --set-upstream origin --force ${{ env.BRANCH }}
72-
#
73-
# - name: Setup tmate session
74-
# if: ${{ always() }}
75-
# timeout-minutes: 30 # Run `sudo shutdown -h now` to terminate the session
76-
# env:
77-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78-
# uses: mxschmitt/action-tmate@v3
36+
- run: echo ${{ env.BRANCH }}

0 commit comments

Comments
 (0)