Skip to content

Commit

Permalink
Merge pull request #182 from zerotier/release-trigger
Browse files Browse the repository at this point in the history
deploy prod on release
  • Loading branch information
glimberg authored Aug 16, 2024
2 parents 0093b22 + ba4aa93 commit 5f7d6e1
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/deploy_prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
release:
types: [published]

jobs:
build:
name: Deploy Release
runs-on: gha-runner-x64

steps:
- uses: actions/checkout@v4

- name: Set Node.js 20.x
uses: actions/setup-node@v4
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.ref_name }} . --push
- name: Deploy docs-dev
run: |
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_prod", "client_payload": {"docker_tag": "${{ github.ref_name }}"}}'

0 comments on commit 5f7d6e1

Please sign in to comment.