8
8
tags :
9
9
- " v[0-9]+.[0-9]+.[0-9]+"
10
10
branches :
11
+ - main
11
12
- " staging**"
12
13
workflow_dispatch :
13
14
@@ -22,57 +23,14 @@ jobs:
22
23
build-website :
23
24
# Note: `github.event.base_ref` is equal to `refs/heads/main` only when the workflow is triggered
24
25
# by a lightweight tag (_not_ an annotated tag) placed on the last commit of the `main` branch
25
- if : github.event.base_ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/staging')
26
+ # if: github.event.base_ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/staging')
26
27
runs-on : ubuntu-latest
27
28
steps :
28
29
- uses : actions/checkout@v4
29
30
30
- - run : echo "nvmrc=$(cat .nvmrc)" >> $GITHUB_ENV
31
- id : nvmrc
31
+ - run : echo ${{ startsWith(github.ref, 'refs/tags/') }}
32
32
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=$([[ "$(git rev-parse HEAD)" == "$(git rev-parse origin/main)" ]] && echo "dist" || echo "staging/dist")" >> $GITHUB_ENV
44
34
id : BRANCH
45
35
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