This repository has been archived by the owner on Dec 21, 2024. It is now read-only.
Frontend CI #59
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
# 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: Frontend CI | |
on: | |
push: | |
tags: | |
- 'v*' | |
# branches: [ "main" ] | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '18.x' | |
- name: Cache dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Create and populate .env file | |
env: | |
REACT_APP_NYM_CLIENT_SERVER: ${{ secrets.REACT_APP_NYM_CLIENT_SERVER }} | |
SERVER_NAME: ${{ secrets.SERVER_NAME }} | |
HOSTED_BY: ${{ secrets.HOSTED_BY }} | |
HOSTED_BY_NAME: ${{ secrets.HOSTED_BY_NAME }} | |
SOCIAL_TWITTER: ${{ secrets.SOCIAL_TWITTER }} | |
SOCIAL_EMAIL: ${{ secrets.SOCIAL_EMAIL }} | |
SOCIAL_TELEGRAM: ${{ secrets.SOCIAL_TELEGRAM }} | |
SOCIAL_MATRIX: ${{ secrets.SOCIAL_MATRIX }} | |
SOCIAL_GITHUB: ${{ secrets.SOCIAL_GITHUB }} | |
SOCIAL_MEDIUM: ${{ secrets.SOCIAL_MEDIUM }} | |
run: | | |
cat <<EOF > .env | |
REACT_APP_NYM_CLIENT_SERVER="$REACT_APP_NYM_CLIENT_SERVER" | |
GENERATE_INFO_FILE_ABOUT_INSTANCE="true" | |
SERVER_NAME="$SERVER_NAME" | |
HOSTED_BY="$HOSTED_BY" | |
HOSTED_BY_NAME="$HOSTED_BY_NAME" | |
SOCIAL_TWITTER="$SOCIAL_TWITTER" | |
SOCIAL_EMAIL="$SOCIAL_EMAIL" | |
SOCIAL_TELEGRAM="$SOCIAL_TELEGRAM" | |
SOCIAL_MATRIX="$SOCIAL_MATRIX" | |
SOCIAL_GITHUB="$SOCIAL_GITHUB" | |
SOCIAL_MEDIUM="$SOCIAL_MEDIUM" | |
EOF | |
- name: npm build | |
working-directory: ./ | |
run: | | |
npm install | |
npm run build | |
env: | |
CI: false | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./dist | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |