@@ -5,9 +5,10 @@ name: Build website
5
5
6
6
on :
7
7
push :
8
+ tags :
9
+ - " v[0-9]+.[0-9]+.[0-9]+"
8
10
branches :
9
- - main
10
- - staging/**
11
+ - " staging**"
11
12
workflow_dispatch :
12
13
13
14
permissions :
@@ -19,6 +20,9 @@ concurrency:
19
20
20
21
jobs :
21
22
build-website :
23
+ # Note: `github.event.base_ref` is equal to `refs/heads/main` only when the workflow is triggered
24
+ # 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') || github.event_name == 'workflow_dispatch'
22
26
runs-on : ubuntu-latest
23
27
steps :
24
28
- uses : actions/checkout@v4
36
40
- run : echo "APP_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
37
41
id : APP_VERSION
38
42
39
- - run : echo "BRANCH=$([[ "$(git branch --show-current)" == " main" ]] && echo "dist" || echo "staging/dist")" >> $GITHUB_ENV
43
+ - run : echo "BRANCH=$(${{ github.event.base_ref == 'refs/heads/main' || github.ref == 'refs/heads/ main' }} && echo "dist" || echo "staging/dist")" >> $GITHUB_ENV
40
44
id : BRANCH
41
45
42
46
- run : echo "SENTRY_ENVIRONMENT=$([[ "${{ env.BRANCH }}" == "dist" ]] && echo "production" || echo "staging")" >> $GITHUB_ENV
@@ -46,25 +50,25 @@ jobs:
46
50
DOMAIN : " ${{ secrets.DOMAIN }}"
47
51
run : sed -i "s/\$DOMAIN/${{ env.DOMAIN }}/" index.html
48
52
49
- - env :
50
- ENVIRONMENT : " ${{ env.SENTRY_ENVIRONMENT }}"
51
- APP_VERSION : " ${{ env.APP_VERSION }}"
52
- DOMAIN : " ${{ secrets.DOMAIN }}"
53
- SENTRY_INGEST : " ${{ secrets.SENTRY_INGEST }}"
54
- PLAUSIBLE_API_URL : " ${{ secrets.PLAUSIBLE_API_URL }}"
55
- PB_INSTANCES : " ${{ secrets.PB_INSTANCES }}"
56
- run : npm run build
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
57
61
58
- - run : |
59
- git checkout index.html
60
- [[ "${{ env.BRANCH }}" != "dist" ]] && git fetch && git branch main remotes/origin/main
61
- git switch --orphan ${{ env.BRANCH }}
62
- git checkout main netlify.toml
63
- git add docs
64
- git config user.name "Zwyx - GitHub Actions"
65
- git config user.email "[email protected] >"
66
- git commit -m "Build website"
67
- git push --set-upstream origin --force ${{ env.BRANCH }}
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 }}
68
72
#
69
73
# - name: Setup tmate session
70
74
# if: ${{ always() }}
0 commit comments