-
Notifications
You must be signed in to change notification settings - Fork 8
57 lines (54 loc) · 2.09 KB
/
build-no-cache.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Deploy Website No Cache
on:
workflow_dispatch:
jobs:
build-website:
name: Build Website
runs-on: [earthly-satellite#gha-website]
steps:
- uses: FranzDiebold/github-env-vars-action@v2
- name: Checkout code
uses: actions/checkout@v3
- name: Build Site
uses: mathiasvr/command-output@v1
id: build-site
env:
FORCE_COLOR: 1
EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }}
EARTHLY_INSTALL_ID: "earthly-website-githubactions"
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_STAGING_SITE_ID: ${{ secrets.NETLIFY_STAGING_SITE_ID }}
NETLIFY_STAGING_AUTH_TOKEN: ${{ secrets.NETLIFY_STAGING_AUTH_TOKEN }}
with:
run: |-
echo "Setup Satellite"
echo "Build and publish website"
if [ "$CI_ACTION_REF_NAME" == "main" ]; then
echo "Main Build - going to prod!"
earthly \
--no-cache \
--secret NETLIFY_SITE_ID="$NETLIFY_SITE_ID" \
--secret NETLIFY_AUTH_TOKEN="$NETLIFY_AUTH_TOKEN" \
--build-arg DESTINATION="PROD" \
--build-arg DATE="$(date +"%D")" \
+publish 2>&1
else
echo "Branch Build - only for preview"
earthly \
--no-cache \
--secret NETLIFY_STAGING_SITE_ID="$NETLIFY_STAGING_SITE_ID" \
--secret NETLIFY_STAGING_AUTH_TOKEN="$NETLIFY_STAGING_AUTH_TOKEN" \
--build-arg DATE="$(date +"%D")" \
+publish 2>&1
fi
- name: match
continue-on-error: true
uses: actions-ecosystem/action-regex-match@v2
id: regex-match
with:
text: ${{ steps.build-site.outputs.stdout }}
regex: 'https.*netlify.app'
- name: Comment on build
run: |-
echo "Preview URL: ${{ steps.regex-match.outputs.match }}" >> $GITHUB_STEP_SUMMARY