-
Notifications
You must be signed in to change notification settings - Fork 64
159 lines (157 loc) · 6.22 KB
/
tipdeploy.yaml
File metadata and controls
159 lines (157 loc) · 6.22 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# Code generated internal/ci/ci_tool.cue; DO NOT EDIT.
name: tip deploy
"on":
push:
branches:
- ci/test
- master
workflow_dispatch: {}
env: {}
concurrency:
group: tip deploy
cancel-in-progress: false
jobs:
test:
defaults:
run:
shell: bash --noprofile --norc -euo pipefail {0}
permissions:
contents: read
id-token: write
packages: write
runs-on: namespace-profile-linux-amd64;overrides.cache-tag=cue-dispatch-workflow
if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test'))
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Reset git directory modification times
run: touch -t 202211302355 $(find * -type d)
- name: Restore git file modification times
uses: chetan/git-restore-mtime-action@cbf8161ddb4e9b162409104954fb540e8a38c1da
- id: DispatchTrailer
name: Try to extract Dispatch-Trailer
run: |-
x="$(git log -1 --pretty='%(trailers:key=Dispatch-Trailer,valueonly)')"
if [[ "$x" == "" ]]
then
# Some steps rely on the presence or otherwise of the Dispatch-Trailer.
# We know that we don't have a Dispatch-Trailer in this situation,
# hence we use the JSON value null in order to represent that state.
# This means that GitHub expressions can determine whether a Dispatch-Trailer
# is present or not by checking whether the fromJSON() result of the
# output from this step is the JSON value null or not.
x=null
fi
echo "value<<EOD" >> $GITHUB_OUTPUT
echo "$x" >> $GITHUB_OUTPUT
echo "EOD" >> $GITHUB_OUTPUT
- if: |-
((github.ref == 'refs/heads/master') && (! (contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"')))) && (contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"'))
name: Check we don't have Dispatch-Trailer on a protected branch
run: |-
echo "github.event.head_commit.message contains Dispatch-Trailer but we are on a protected branch"
false
- if: runner.os == 'macOS'
name: Set TMPDIR environment variable (${{runner.os}})
run: |-
mkdir $HOME/.tmp
echo "TMPDIR=$HOME/.tmp" >> $GITHUB_ENV
- if: runner.os == 'macOS'
name: Write lima config (${{runner.os}})
run: |-
mkdir -p ~/.lima/default
cat <<EOD > ~/.lima/default/lima.yaml
mounts:
- location: "~"
writable: true
- location: "$TMPDIR"
writable: true
EOD
- if: runner.os == 'macOS'
name: Install Docker (${{runner.os}})
run: |-
brew install colima docker
colima start --mount-type virtiofs
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- if: runner.os == 'macOS'
name: Set DOCKER_HOST environment variable (${{runner.os}})
run: echo "DOCKER_HOST=unix://$HOME/.colima/default/docker.sock" >> $GITHUB_ENV
- if: runner.os == 'macOS'
name: Install macOS utils
run: brew install coreutils
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 24.13.1
- name: Install Go
uses: actions/setup-go@v6
with:
cache: false
go-version: 1.26.0
- name: Set common go env vars
run: |-
case $(go env GOARCH) in
amd64) go env -w GOAMD64=v3 ;; # 2013 and later; makes `go test -race` 15% faster
arm64) go env -w GOARM64=v8.6 ;; # Apple M2 and later
esac
# Dump env for good measure
go env
- if: runner.os == 'Linux'
name: Install Hugo (${{ runner.os }})
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 0.155.3
extended: true
- if: runner.os == 'macOS'
name: Install Hugo (${{ runner.os }})
run: brew install hugo
- name: 'Set PREPROCESSOR_NOWRITECACHE if Preprocessor-No-Write-Cache: true'
run: |
if ./_scripts/noWriteCache.bash HEAD
then
echo 'Found Preprocessor-No-Write-Cache trailer'
echo "PREPROCESSOR_NOWRITECACHE=true" >> $GITHUB_ENV
fi
- if: github.event_name != 'schedule' && matrix.runner != 'ns-windows-amd64'
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: go
path: |-
~/.cache/node-gyp
~/.npm
${{ github.workspace }}/playground/.webpack_cache
- if: |-
github.repository == 'cue-lang/cuelang.org' && (((github.ref == 'refs/heads/master') && (! (contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test'))
run: go env -w GOFLAGS=-count=1
- name: Early git and code sanity checks
run: go run cuelang.org/go/internal/ci/checks@v0.15.0
- name: Perform early content checks
run: _scripts/contentLint.bash
- name: Login to CUE registry
uses: cue-labs/registry-login-action@v1
- name: 'tip.cuelang.org: Patch the site to be compatible with the tip of cue-lang/cue'
run: _scripts/tipPatchApply.bash
- name: npm install in hugo
run: npm install
working-directory: hugo
- name: 'tip.cuelang.org: Configure the site to use the tip of cue-lang/cue'
env:
GOPRIVATE: cuelang.org/go
run: _scripts/tipUseAlternativeCUE.bash
- name: 'tip.cuelang.org: Build the site against the tip of cue-lang/cue'
run: _scripts/regenPostInfraChange.bash
env:
GOPRIVATE: cuelang.org/go
- name: 'tip.cuelang.org: Deploy the site'
run: |-
git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)"
_scripts/tipDeploy.bash 'cueckoo' 'cueckoo@gmail.com'
env:
GOPRIVATE: cuelang.org/go