Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
79 changes: 51 additions & 28 deletions .github/workflows/release.yml → .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,76 @@
name: Release
name: Deploy Docs
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-release
group: ${{ github.workflow }}-${{ github.ref }}-deploy-docs
cancel-in-progress: false
jobs:
deploy-package:
deploy-docs-next:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: package
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
DOCKER_IMAGE: ghcr.io/${{ github.repository }}-docs:next
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Login to GitHub container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build docker image
uses: docker/build-push-action@v2
with:
context: .
load: true
cache-from: type=gha,scope=package
cache-to: type=gha,mode=max,scope=package
push: true
cache-from: type=gha,scope=docs-app
cache-to: type=gha,mode=max,scope=docs-app
tags: ${{ env.DOCKER_IMAGE }}
- name: Create .npmrc file
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- name: Publish package to npm
run: docker run -v $(pwd)/.npmrc:/root/.npmrc $DOCKER_IMAGE make publish
file: ./docs.Dockerfile
run-docs-next:
needs: deploy-docs-next
runs-on: ubuntu-latest
env:
NAME: ui-react-docs-next
DOCKER_IMAGE: ghcr.io/${{ github.repository }}-docs:next
steps:
- name: executing remote ssh commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.KIBA_APP_BOX_URL }}
username: ${{ secrets.KIBA_APP_BOX_USER }}
key: ${{ secrets.KIBA_APP_BOX_SSH_KEY }}
port: ${{ secrets.KIBA_APP_BOX_PORT }}
envs: DOCKER_IMAGE,NAME
script_stop: true
script: |
url="ui-react-docs-next.kibalabs.com"
varsFile=~/.${NAME}.vars
docker pull ${DOCKER_IMAGE}
docker stop ${NAME} && docker rm ${NAME} || true
docker run \
--name ${NAME} \
--detach \
--publish-all \
--restart on-failure \
--env NAME=${NAME} \
--env VIRTUAL_HOST=${url} \
--env LETSENCRYPT_HOST=${url} \
--env-file ${varsFile} \
${DOCKER_IMAGE}
deploy-docs:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: ghcr.io/${{ github.repository }}-docs:latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Login to GitHub container registry
uses: docker/login-action@v2
with:
Expand All @@ -54,6 +90,7 @@ jobs:
file: ./docs.Dockerfile
run-docs:
needs: deploy-docs
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
env:
NAME: ui-react-docs
Expand Down Expand Up @@ -83,17 +120,3 @@ jobs:
--env LETSENCRYPT_HOST=${url} \
--env-file ${varsFile} \
${DOCKER_IMAGE}
create-release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
77 changes: 21 additions & 56 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: Deploy
name: Deploy Package
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-deploy
cancel-in-progress: false
jobs:
deploy-package-next:
deploy-package:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: package
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# NOTE(krishan711): need full history to calculate difference
fetch-depth: 0
Expand All @@ -34,60 +35,24 @@ jobs:
- name: Create .npmrc file
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- name: Publish next package to npm
if: steps.vars.outputs.commit_count != '0'
if: steps.vars.outputs.commit_count != '0' && github.ref == 'refs/heads/main'
run: docker run -v $(pwd)/.npmrc:/root/.npmrc $DOCKER_IMAGE make NEXT_VERSION=${{ steps.vars.outputs.commit_count }} publish-next
deploy-docs-next:
- name: Publish package to npm
if: startsWith(github.ref, 'refs/tags/v')
run: docker run -v $(pwd)/.npmrc:/root/.npmrc $DOCKER_IMAGE make publish
create-release:
Comment thread
krishan711 marked this conversation as resolved.
needs: deploy-package
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: ghcr.io/${{ github.repository }}-docs:next
permissions:
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Login to GitHub container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
cache-from: type=gha,scope=docs-app
cache-to: type=gha,mode=max,scope=docs-app
tags: ${{ env.DOCKER_IMAGE }}
file: ./docs.Dockerfile
run-docs-next:
needs: deploy-docs-next
runs-on: ubuntu-latest
env:
NAME: ui-react-docs-next
DOCKER_IMAGE: ghcr.io/${{ github.repository }}-docs:next
steps:
- name: executing remote ssh commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.KIBA_APP_BOX_URL }}
username: ${{ secrets.KIBA_APP_BOX_USER }}
key: ${{ secrets.KIBA_APP_BOX_SSH_KEY }}
port: ${{ secrets.KIBA_APP_BOX_PORT }}
envs: DOCKER_IMAGE,NAME
script_stop: true
script: |
url="ui-react-docs-next.kibalabs.com"
varsFile=~/.${NAME}.vars
docker pull ${DOCKER_IMAGE}
docker stop ${NAME} && docker rm ${NAME} || true
docker run \
--name ${NAME} \
--detach \
--publish-all \
--restart on-failure \
--env NAME=${NAME} \
--env VIRTUAL_HOST=${url} \
--env LETSENCRYPT_HOST=${url} \
--env-file ${varsFile} \
${DOCKER_IMAGE}
uses: actions/checkout@v4
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.ref_name }} \
--title "Release ${{ github.ref_name }}" \
--generate-notes
Loading