Skip to content

archive

archive #48

Workflow file for this run

name: archive
on:
workflow_dispatch:
inputs:
version:
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
- name: Install dependencies
uses: borales/actions-yarn@3766bb1335b98fb13c60eaf358fe20811b730a88 # v5.0.0
with:
cmd: install --frozen-lockfile
- name: Redirect pp and cloud links to last documentation
run: |
find versioned_docs versioned_sidebars -regex ".*\.\(md\|json\)" | xargs --delimiter='\n' sed -i 's#/cloud/#https://docs.centreon.com/cloud/#g'
find versioned_docs versioned_sidebars -regex ".*\.\(md\|json\)" | xargs --delimiter='\n' sed -i 's#/pp/#https://docs.centreon.com/pp/#g'
shell: bash
- name: Build documentation for ${{ github.event.inputs.version }}
run: ARCHIVED_VERSION="${{ github.event.inputs.version }}" yarn build
- name: Store build archived doc in cache
uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: "./build"
key: "${{ github.sha }}-${{ github.run_id }}-build-archived-doc"
publish:
needs: [build]
runs-on: [self-hosted, infra]
steps:
- name: Restore built archived doc from cache
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: "./build"
key: "${{ github.sha }}-${{ github.run_id }}-build-archived-doc"
fail-on-cache-miss: true
- name: Setup awscli
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo unzip -q awscliv2.zip
sudo ./aws/install
shell: bash
- name: Copy to S3
run: aws s3 sync --delete "build/" s3://centreon-documentation-archive/${{ github.event.inputs.version }}/