Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github actions for building & linting docs site #178

Merged
merged 32 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d5a540a
github actions for building & linting docs site
glimberg Aug 15, 2024
10fb2b6
use ubuntu-latest
glimberg Aug 15, 2024
90c725b
test
glimberg Aug 15, 2024
92c6f72
workflow update
glimberg Aug 15, 2024
8fdaf30
let's try a yarn cache
glimberg Aug 15, 2024
ad30517
remove conditional on yarn install
glimberg Aug 15, 2024
70a4068
looks like explicitly saving isn't necessary
glimberg Aug 15, 2024
7182f7a
looks like explicitly saving the cache isn't required
glimberg Aug 15, 2024
aa3d9cf
try a docker build
glimberg Aug 15, 2024
6ad2e62
oops
glimberg Aug 15, 2024
0641f05
should auth here
glimberg Aug 15, 2024
125bb0f
setup
glimberg Aug 15, 2024
ad1ea5d
one too many brackets
glimberg Aug 15, 2024
65cd292
hmm
glimberg Aug 15, 2024
4d28b0e
hmm
glimberg Aug 15, 2024
0c2b2b1
.
glimberg Aug 15, 2024
0b77da4
build docker for dev site on merge to main
glimberg Aug 15, 2024
8e0af80
Merge branch 'main' into github-action-build
glimberg Aug 15, 2024
99f8a8b
let's try this
glimberg Aug 15, 2024
bbe85e2
different curl action
glimberg Aug 15, 2024
c94520e
bump
glimberg Aug 15, 2024
b619af4
quote esacping, and lets speed up the actions. no need to actually b…
glimberg Aug 15, 2024
64512ad
skip lint too
glimberg Aug 15, 2024
8632286
more string futzing
glimberg Aug 15, 2024
032b0ec
another curl
glimberg Aug 15, 2024
60ab486
...
glimberg Aug 16, 2024
60b81e3
...
glimberg Aug 16, 2024
07201ff
...
glimberg Aug 16, 2024
767a084
...
glimberg Aug 16, 2024
bbf9746
...
glimberg Aug 16, 2024
f25bb1a
...
glimberg Aug 16, 2024
fb760cd
ok. that should finally work
glimberg Aug 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]


jobs:
build:
name: Build
runs-on: gha-runner-x64

steps:
- uses: actions/checkout@v4

- name: Set Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: [email protected]
run: |
corepack enable && corepack prepare [email protected]

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: Get yarn cache
uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-${{ runner.arch }}-yarn-docs-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-yarn-docs-

- name: Install dependencies
uses: borales/actions-yarn@v5
with:
cmd: install --immutable

- name: Build
uses: borales/actions-yarn@v5
with:
cmd: build
env:
NODE_OPTIONS: --openssl-legacy-provider

- name: Lint
uses: borales/actions-yarn@v5
with:
cmd: lint
env:
NODE_OPTIONS: --openssl-legacy-provider


65 changes: 65 additions & 0 deletions .github/workflows/deploy_dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy to Dev
on:
push:
branches:
- main

jobs:
build:
name: Build
runs-on: gha-runner-x64

steps:
- uses: actions/checkout@v4

- name: Set Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: [email protected]
run: |
corepack enable && corepack prepare [email protected]

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: Get yarn cache
uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-${{ runner.arch }}-yarn-docs-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-yarn-docs-

- name: Install dependencies
uses: borales/actions-yarn@v5
with:
cmd: install --immutable

- name: Build
uses: borales/actions-yarn@v5
with:
cmd: build
env:
NODE_OPTIONS: --openssl-legacy-provider

- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.DOCKER_REGISTRY_WRITER }}'

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'

- name: Docker Build
run: |
gcloud auth configure-docker ${{ secrets.GCLOUD_DOCKER_HOST }}
docker build -t ${{ secrets.GCLOUD_DOCKER_HOST }}/${{ secrets.GCLOUD_PROJECT_ID }}/zt-docker/docs-zerotier-com:${{ github.sha }} . --push

- name: Deploy docs-dev
run: |
sudo apt-get update && sudo apt-get install -y curl
curl -s -L -X POST -H 'Accept: application/vnd.github+json' -H 'Authorization: Bearer ${{ secrets.DEPLOY_TOKEN }}' -H 'X-GitHub-Api-Version: 2022-11-28' https://api.github.com/repos/zerotier/${{ secrets.INFRA_REPO_NAME }}/dispatches -d '{"event_type": "deploy_docs_dev", "client_payload": {"docker_tag": "${{ github.sha }}"}}'
Loading