-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (144 loc) · 5.41 KB
/
deploy.yml
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
160
161
162
163
164
165
name: Deploy website on push
on:
push:
branches:
- main
workflow_dispatch:
# Check out fluxcd/website .github/workflows/netlify.yml
# We should emulate this fully - it has a hook from the fluxcd/community
# repository's github actions that enables community to trigger a deploy
repository_dispatch:
types: [trigger-workflow]
# (That's what a repository_dispatch workflow is meant to be doing here)
jobs:
fermyon-deploy:
permissions:
# contents: write # Required for creating the GitHub release
packages: write # Required for pushing to GitHub Container Registry
id-token: write # Required for Cosign
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Get latest flux-docs
uses: actions/checkout@v4
- name: Get fluxcd/website (test-community)
uses: actions/checkout@v4
with:
repository: fluxcd/website
ref: main
path: website
# Prerequisites:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.122.0'
extended: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '^1.21.0'
# Build:
- name: Build content
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# make production-build URL=https://docs-fluxcd-website-6lrhgsuf.fermyon.app/
pushd website
pip install -r requirements.txt
hugo version; popd
make build
pushd website/public
rm -r flagger blog img/logos flux/cmd flux/components
rm -r flux/installation img/diagrams
rm -r flux/use-cases flux/guides flux/monitoring flux/migration
rm -rf flux/gitops-toolkit img/screens shortcode-gallery img/*.png
rm -r flux/cheatsheets # Get us below 200 (https://github.com/spinkube/containerd-shim-spin/issues/28)
rm -r favicons contributing/docs
popd
- name: Install Spin
uses: fermyon/actions/spin/setup@v1
# Push: WASM
- name: Push to OCI
id: push
uses: fermyon/actions/spin/push@v1
with:
registry: ghcr.io
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
registry_reference: "ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-2"
manifest_file: spin.toml
# Push: Docker WASM (alternate while spin registry push cannot be used)
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: setup buildx
# uses: docker/setup-buildx-action@v3
# - name: login to GitHub container registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: enable containerd image store
# run: |
# echo '{ "features": { "containerd-snapshotter": true } }' | sudo tee /etc/docker/daemon.json
# sudo systemctl restart docker
# # Copied from https://github.com/spinkube/containerd-shim-spin/blob/main/.github/workflows/docker-build-push.yaml
# - name: build and push
# uses: docker/build-push-action@v5
# with:
# push: true
# tags: |
# ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-3
# ghcr.io/kingdon-ci/flux-docs/build:latest
# context: .
# platforms: wasi/wasm
# provenance: false
# Deploy:
# - name: Deploy to Fermyon Cloud
# uses: fermyon/actions/spin/deploy@v1
# with:
# fermyon_token: ${{ secrets.FERMYON_CLOUD_TOKEN }}
# run_build: false
- name: Set up Flux CLI
uses: fluxcd/flux2/[email protected]
# Update: Kubernetes manifests
- name: Set Image (Kustomize SpinApp)
run: |
pushd deploy/spin-app
kustomize edit set image flux-docs/build=ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-2
popd
# Login: GHCR
#(Moved up to Docker build action while spin registry push is not viable for us)
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install cosign
uses: sigstore/[email protected]
- name: Cosign version
run: cosign version
# Push: Kubernetes (Flux App)
- name: Push manifests
run: |
flux push artifact \
oci://ghcr.io/kingdon-ci/flux-docs/manifests:latest \
--path=deploy \
--source=${{ github.repositoryUrl }} \
--revision="${{ github.ref_name }}@sha1:${{ github.sha }}" \
--annotations='org.opencontainers.image.description=Fluxcd.io website SpinKube manifests'
# Sign: Kubernetes manifests
- name: Sign OCI YAML manifests
run: |
# keyless mode
cosign sign ghcr.io/kingdon-ci/flux-docs/manifests:latest -y
# Sign: Spin app OCI artifact
- name: Sign OCI WASM artifact
run: |
# keyless mode
cosign sign ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-2 -y