Merge pull request #511 from ByteInternet/revise-workflows-standards #1592
This file contains hidden or 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 to production | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| concurrency: | |
| group: production | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| container: quay.io/hypernode/deploy:latest-php8.4-node22 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # updated_at.py reads the git log to render per-page timestamps. | |
| fetch-depth: 0 | |
| - name: Add repository to git safe directories | |
| run: git config --global --add safe.directory $GITHUB_WORKSPACE | |
| - name: Set env for production build | |
| run: | | |
| echo "DOCS_BASE_URL=https://docs.hypernode.com/" >> $GITHUB_ENV | |
| echo "DOCS_INDEX_FOLLOW=1" >> $GITHUB_ENV | |
| # The prepare:ssh task fails on an empty ssh-agent, but building needs no | |
| # server access, so satisfy it with a key that grants access to nothing. | |
| - name: Generate a throwaway SSH key for the build | |
| run: mkdir -p ~/.ssh && ssh-keygen -t ed25519 -N '' -q -f ~/.ssh/id_ed25519 | |
| - run: hypernode-deploy build -vvv | |
| - name: archive production artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: deployment-build | |
| path: build/build.tgz | |
| retention-days: 5 | |
| deploy_production: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| environment: | |
| name: production | |
| url: https://docs.hypernode.com | |
| permissions: | |
| contents: read | |
| container: quay.io/hypernode/deploy:latest-php8.4-node22 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: deployment-build | |
| path: build/ | |
| - uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - run: mkdir -p $HOME/.ssh | |
| - name: deploy to production | |
| run: hypernode-deploy deploy production -vvv |