Merge pull request #83 from vuestorefront-community/mkoszut-patch-1 #69
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Documentation | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v1 | |
- shell: bash | |
run: | | |
echo "1.0.`date +%s`" > version.txt | |
- name: Upload version artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: version | |
path: version.txt | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT | |
- name: Build and publish docker image | |
uses: elgohr/Publish-Docker-Github-Action@v5 | |
with: | |
name: docs-storefrontcloud-io/v2-odoo:${{ steps.get_version.outputs.VERSION }} | |
registry: registry.storefrontcloud.io | |
username: ${{ secrets.DOCS_CLOUD_USERNAME }} | |
password: ${{ secrets.DOCS_CLOUD_PASSWORD }} | |
workdir: . | |
dockerfile: ./.vuestorefrontcloud/docker/docs/Dockerfile | |
buildoptions: "--compress" | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download version artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: version | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT | |
- uses: chrnorm/deployment-action@releases/v1 | |
name: Create GitHub deployment | |
id: deployment | |
with: | |
token: "${{ github.token }}" | |
target_url: https://docs.europe-west1.gcp.storefrontcloud.io/odoo | |
environment: production | |
initial_status: in_progress | |
- name: Deploy on docs.europe-west1.gcp.storefrontcloud.io/odoo | |
id: publish | |
uses: vuestorefront/publish-docs-action@main | |
with: | |
user-id: ${{ secrets.DOCS_CLOUD_USERNAME }} | |
api-key: ${{ secrets.DOCS_CLOUD_PASSWORD }} | |
name: "docs-v2-odoo" | |
tag: "${{ steps.get_version.outputs.VERSION }}" | |
image: "registry.storefrontcloud.io/docs-storefrontcloud-io/v2-odoo" | |
path: "/odoo" | |
port: "80" | |
has-base-path: true | |
- name: Update deployment status (success) | |
if: success() | |
uses: chrnorm/deployment-status@releases/v1 | |
with: | |
token: "${{ github.token }}" | |
target_url: https://docs.europe-west1.gcp.storefrontcloud.io/odoo | |
state: "success" | |
description: Congratulations! The deploy is done. | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
- name: Update deployment status (failure) | |
if: failure() | |
uses: chrnorm/deployment-status@releases/v1 | |
with: | |
token: "${{ github.token }}" | |
target_url: https://docs.europe-west1.gcp.storefrontcloud.io/odoo | |
description: Unfortunately, the instance hasn't been updated. | |
state: "failure" | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} |