Skip to content

Add authN token refresh #126

Add authN token refresh

Add authN token refresh #126

name: "Deploy:Webclient"
on:
push:
branches:
- master
paths:
- "webclient/**"
pull_request:
paths:
- "webclient/**"
workflow_dispatch:
defaults:
run:
working-directory: "webclient"
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Test
run: |
npm install
npm run test
deploy-stage:
runs-on: ubuntu-20.04
env:
VITE_URL_API: "https://api-stage.diagramastext.dev"
needs:
- test
environment:
name: "staging:webclient"
if: github.ref == 'refs/heads/master' || (github.event.pull_request.merged == 'true' && github.base_ref == 'master' )
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build
run: |
export VITE_VERSION=$GITHUB_SHA
npm install
npm run build
- name: Add api spec page
run: |
docker run -e SERVER=$VITE_URL_API -v ${PWD}/api-reference:/app -t hairyhenderson/gomplate:stable -f /app/api-spec.yaml -o /app/api-spec.yaml
cp -r api-reference dist/
- name: Sync webclient
uses: cpina/[email protected]
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
target-branch: "master"
destination-github-username: "kislerdm"
destination-repository-name: "diagramastext-webclient-stg"
source-directory: "webclient/dist"
target-directory: "webclient"
deploy-prod:
runs-on: ubuntu-20.04
env:
VITE_URL_API: "https://api.diagramastext.dev"
needs:
- deploy-stage
environment:
name: "production:webclient"
url: ${{ steps.deployment.outputs.page_url }}
if: github.ref == 'refs/heads/master' || (github.event.pull_request.merged == 'true' && github.base_ref == 'master' )
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build
run: |
export VITE_VERSION=$GITHUB_SHA
npm install
npm run build
- name: Add api spec page
run: |
docker run -e SERVER=$VITE_URL_API -v ${PWD}/api-reference:/app -t hairyhenderson/gomplate:stable -f /app/api-spec.yaml -o /app/api-spec.yaml
cp -r api-reference dist/
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'webclient/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2