Skip to content

Merge pull request #266 from ByteInternet/fix-typos-in-hmv-docs #759

Merge pull request #266 from ByteInternet/fix-typos-in-hmv-docs

Merge pull request #266 from ByteInternet/fix-typos-in-hmv-docs #759

Workflow file for this run

name: Deploy application
on:
pull_request:
push:
branches:
- 'master'
env:
COMPOSER_CACHE_DIR: /tmp/composer-cache
jobs:
build:
runs-on: ubuntu-latest
container: quay.io/hypernode/deploy:3-php8.1-node18
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Declares the repository safe and not under dubious ownership.
- name: Add repository to git safe directories
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-composer
- uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set env for production build
if: github.ref == 'refs/heads/master'
run: |
echo "DOCS_BASE_URL=https://docs.hypernode.com/" >> $GITHUB_ENV
echo "DOCS_INDEX_FOLLOW=1" >> $GITHUB_ENV
- run: hypernode-deploy build -vvv
- name: archive production artifacts
uses: actions/upload-artifact@v3
with:
name: deployment-build
path: build/build.tgz
retention-days: 5
deploy_acceptance:
needs: build
runs-on: ubuntu-latest
environment:
name: acceptance
url: ${{ steps.get_brancher_hostname.outputs.BRANCHER_URL }}
if: github.ref != 'refs/heads/master'
container: quay.io/hypernode/deploy:3-php8.1-node18
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: download build artifact
uses: actions/download-artifact@v3
with:
name: deployment-build
path: build/
- uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- run: mkdir -p $HOME/.ssh
- name: deploy to acceptance
run: hypernode-deploy deploy acceptance -vvv --reuse-brancher
env:
HYPERNODE_API_TOKEN: ${{ secrets.HYPERNODE_API_TOKEN }}
- name: Get brancher hostname
id: get_brancher_hostname
run: echo "BRANCHER_URL=https://$(jq .hostnames[0] deployment-report.json -r)" >> $GITHUB_OUTPUT
- name: Get changed pages
id: changed_pages
run: |
git config --global --add safe.directory $(pwd)
commits=${{ github.event.pull_request.commits }}
if [[ -n "$commits" ]]; then
# Prepare enough depth for diffs with target branch
git fetch --depth="$(( commits + 1 ))"
fi
result="$(python3 ci/bin/get_changed_urls.py \
${{ github.event.pull_request.base.sha }} \
${{github.event.pull_request.head.sha}} \
--base-url=${{ steps.get_brancher_hostname.outputs.BRANCHER_URL }}
)"
echo "$result"
echo "CHANGED_PAGES<<EOF" >> $GITHUB_OUTPUT
echo "$result" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
shell: bash
- name: Comment hostname on PR
uses: thollander/actions-comment-pull-request@v1
with:
message: |
Acceptance server is available at ${{ steps.get_brancher_hostname.outputs.BRANCHER_URL }}.
${{ steps.changed_pages.outputs.CHANGED_PAGES }}
deploy_production:
needs: build
runs-on: ubuntu-latest
concurrency: production
environment:
name: production
url: https://docs.hypernode.io
if: github.ref == 'refs/heads/master'
container: quay.io/hypernode/deploy:3-php8.1-node18
steps:
- uses: actions/checkout@v3
- name: download build artifact
uses: actions/download-artifact@v3
with:
name: deployment-build
path: build/
- uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- run: mkdir -p $HOME/.ssh
- name: deploy to production
run: hypernode-deploy deploy production -vvv