Deploy to Production Environment #76
Workflow file for this run
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 Environment | |
# This workflow will trigger on any tag/release created on *any* branch | |
# Make sure to create tags/releases only from the "master" branch for consistency | |
on: | |
release: | |
types: [published] | |
jobs: | |
lint-export-client: | |
name: Lint and Export client | |
if: github.event.release.target_commitish == 'main' | |
runs-on: ubuntu-latest | |
env: | |
NEXT_PUBLIC_BASE_PATH: ${{ secrets.NEXT_PUBLIC_BASE_PATH }} | |
RELEASE_VERSION: ${{ secrets.RELEASE_VERSION }} | |
RELEASE_PAGE: ${{ secrets.RELEASE_PAGE }} | |
COMMIT_ID: ${{ secrets.COMMIT_ID }} | |
OPENGRAPH_IMAGE_URL: ${{ secrets.OPENGRAPH_IMAGE_URL }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Use NodeJS v20.15.0 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.15.0 | |
- name: Install Dependencies and lint | |
run: | | |
cd docs | |
npm install | |
- name: Lint | |
run: | | |
cd docs | |
npm run lint | |
- name: Export static files | |
run: | | |
cd docs | |
npm run export | |
cp config/*.html out/ | |
cp config/sitemap.txt out/ | |
- name: Disable Jekyll | |
run: touch docs/out/.nojekyll | |
- name: Archive Development Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
include-hidden-files: true | |
name: main-out | |
path: docs/out | |
retention-days: 3 | |
deploy-client: | |
name: Deploy client to Github Pages | |
if: github.event.release.target_commitish == 'main' | |
needs: lint-export-client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: main-out | |
- name: List files for publish | |
run: ls -l -a | |
- name: Deploy to Github Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./ | |
publish_branch: gh-pages | |
docker-build-push: | |
name: Push Image to Docker Hub | |
if: github.event.release.target_commitish == 'main' && vars.DOCKERHUB_USERNAME != '' | |
needs: lint-export-client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Create env variables | |
run: cp docs/.env.example docs/.env | |
- name: Build Image | |
run: docker compose -f docker-compose.dev.yml build | |
- name: Push Image to Docker Hub | |
run: docker compose -f docker-compose.dev.yml push |