Skip to content

ciroh-ua-website-cd #185

ciroh-ua-website-cd

ciroh-ua-website-cd #185

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: ciroh-ua-website-cd
on:
workflow_run:
workflows: ["ciroh-ua-website-ci"]
branches:
- main
types:
- completed
workflow_call:
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
name: Deploy to GitHub Pages
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Clear git worktree before deployment
run: |
git worktree prune
if git worktree list | grep -q 'github-pages-deploy-action-temp-deployment-folder'; then
echo "Removing existing temp deployment folder"
git worktree remove github-pages-deploy-action-temp-deployment-folder --force
fi
# Check and remove any worktree associated with the deployment if it exists
if git worktree list | grep -q 'github-pages-deploy-action'; then
echo "Removing existing deployment worktree"
DEPLOYMENT_WORKTREE=$(git worktree list | grep 'github-pages-deploy-action' | awk '{print $1}')
git worktree remove "$DEPLOYMENT_WORKTREE" --force
fi
- name: Download a Build Artifact Version
uses: dawidd6/[email protected]
with:
workflow: ci_pipeline.yml
workflow_conclusion: success
branch: main
name: version
path: ./
- name: Read file and set variable
run: |
# Read file and set its value to a variable
FILE_CONTENT=$(cat ./version.txt)
# Set variable as an environment variable
echo "VERSION=$FILE_CONTENT" >> $GITHUB_ENV
- name: Display variable value
run: |
# Display value of variable
echo "My variable value is $VERSION"
# https://github.com/marketplace/actions/download-workflow-artifact
- name: Download a Build Artifact
uses: dawidd6/[email protected]
with:
workflow: ci_pipeline.yml
workflow_conclusion: success
branch: main
name: build
path: ./build/
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
token: ${{secrets.SECRET_TO_PUSH_TO_CIROH_GITHUB_IO}}
branch: main
folder: build
repository-name: CIROH-UA/ciroh-ua.github.io
#tag: $VERSION