script deploy plugged to docGenerator repo + rename doc/ to docs/
Signed-off-by: slumbering <slumbering.pierrot@gmail.com>
This commit is contained in:
parent
49176b9976
commit
828f9d9ff1
101
.github/workflows/deploy.yml
vendored
Normal file
101
.github/workflows/deploy.yml
vendored
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
# This is a basic workflow to help you get started with Actions
|
||||||
|
|
||||||
|
name: DEPLOY
|
||||||
|
|
||||||
|
# Controls when the action will run.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
paths:
|
||||||
|
- 'doc/**'
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
|
jobs:
|
||||||
|
# This workflow contains a single job called "build"
|
||||||
|
deploy:
|
||||||
|
# The type of runner that the job will run on
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
AWS_DEFAULT_REGION: "eu-west-1"
|
||||||
|
|
||||||
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
|
steps:
|
||||||
|
#################################################################
|
||||||
|
# COMMOMS
|
||||||
|
#################################################################
|
||||||
|
# Get current tag (or 'main') in step output for use in uploads
|
||||||
|
- name: Set Tag Name
|
||||||
|
id: vars
|
||||||
|
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
# FETCH GENERATOR + DATA
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
# fetch gatsby generator from 'dagger/DocGenerator'
|
||||||
|
# then fetch docs data to have generator + data in the context of the job
|
||||||
|
# fetch-depth: '0' enables listing all tags for version selector
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: 'dagger/DocGenerator'
|
||||||
|
ref: 'main'
|
||||||
|
token: ${{ secrets.PAT }} # is a secret that contains your PAT
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: '0'
|
||||||
|
path: 'docsTMP'
|
||||||
|
- run: mkdir -p docs && mv docsTMP/docs/* docs/
|
||||||
|
- run: mv ./docs/index.mdx ./src/@rocketseat/gatsby-theme-docs/text/index.mdx
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
# BUILD SITE
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
# Install Node
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: "14"
|
||||||
|
- run: yarn
|
||||||
|
- name: Build Site
|
||||||
|
run: yarn build --prefix-paths
|
||||||
|
env:
|
||||||
|
VERSION: ${{steps.vars.outputs.tag}}
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
# DEPLOY TO S3
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
|
||||||
|
# deploy the site in the right foder ( tag or main)
|
||||||
|
- name: S3 Sync
|
||||||
|
uses: ItsKarma/aws-cli@v1.70.0
|
||||||
|
with:
|
||||||
|
args: s3 sync --delete --acl public-read public/ s3://daggerdoc.humans-it.com/docs/${{steps.vars.outputs.tag}}/
|
||||||
|
|
||||||
|
# list All Tags in json file for version selector
|
||||||
|
# upload to /tags.json
|
||||||
|
- name: Create tags.json
|
||||||
|
run: echo "[" {\"tag\"':' \"$(git --git-dir ./docsTMP/.git tag -l "v*" | tr '\n' '|' | sed -e 's/|/"}, {\"tag\"':' "/g')main\"} "]" > tags.json
|
||||||
|
- name: Copy tags.json
|
||||||
|
uses: ItsKarma/aws-cli@v1.70.0
|
||||||
|
with:
|
||||||
|
args: s3 cp --acl public-read ./tags.json s3://daggerdoc.humans-it.com/
|
||||||
|
|
||||||
|
# landing alway on latest tag
|
||||||
|
# use S3 Rediret objet
|
||||||
|
# upload to /docs/index.html
|
||||||
|
- run: touch index.html
|
||||||
|
- name: Redirect Latest tag on landing
|
||||||
|
if: ${{ steps.vars.outputs.tag != 'main' }}
|
||||||
|
uses: ItsKarma/aws-cli@v1.70.0
|
||||||
|
with:
|
||||||
|
args: s3 cp --cache-control max-age=0 --acl public-read --website-redirect /docs/${{steps.vars.outputs.tag}}/ ./index.html s3://daggerdoc.humans-it.com/docs/
|
29
.github/workflows/doc.yml
vendored
29
.github/workflows/doc.yml
vendored
@ -1,29 +0,0 @@
|
|||||||
name: Doc
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
paths:
|
|
||||||
- "doc/**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
copy-file:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Pushes docs file
|
|
||||||
uses: dagger/doc_copy_action@main
|
|
||||||
env:
|
|
||||||
API_TOKEN_GITHUB: ${{ secrets.DAGGERCI_TOKEN }}
|
|
||||||
with:
|
|
||||||
source_file: "doc/."
|
|
||||||
destination_repo: "dagger/launch.dagger.io"
|
|
||||||
destination_folder: "site/doc"
|
|
||||||
user_email: "noreply@dagger.io"
|
|
||||||
user_name: "dagger-bot"
|
|
Reference in New Issue
Block a user