Skip to content

MAPEX-167: Mapping File Search #75

MAPEX-167: Mapping File Search

MAPEX-167: Mapping File Search #75

Workflow file for this run

name: Build Editor
on:
push:
branches: [main]
pull_request:
jobs:
mappings_editor_build:
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
# Configure Environment
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
id: "setup-node"
with:
node-version: '19'
cache: 'npm'
cache-dependency-path: 'src/mappings_editor/package-lock.json'
- name: Install dependencies
working-directory: src/mappings_editor/
run: npm ci
# Lint
- name: Lint
working-directory: src/mappings_editor/
run: npm run lint
# Build and Upload Artifact
- name: Type Check
working-directory: ./src/mappings_editor/
run: npm run type-check
- name: Build
working-directory: ./src/mappings_editor/
run: npm run build-only -- --base /${{env.BRANCH_NAME}}/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: mappings_editor
path: src/mappings_editor/dist/
# Delete this job for public release and clear GitHub secrets:
azure_blob:
needs: mappings_editor_build
runs-on: ubuntu-latest
env:
AZURE_STORAGE_ACCOUNT: mappingseditor
AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_SAS_TOKEN }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
STATICRYPT_PASS: ${{ secrets.STATICRYPT_PASS }}
steps:
- uses: actions/setup-node@v3
with:
node-version: "19"
- run: npm install -g staticrypt
- name: Download Web Site
uses: actions/download-artifact@v3
with:
name: mappings_editor
path: mappings_editor
- env:
STATICRYPT_PASS: ${{ secrets.STATICRYPT_PASS }}
run: >
staticrypt --remember 3 --salt c0c22fdf0cd9d2a099db9c90ca4a58bf \
--password $STATICRYPT_PASS --short \
--template-title "Mappings Editor (branch: $BRANCH_NAME)" \
--template-instructions "The contents of this site are marked TLP:AMBER:CTID-R&D:22-80. Do not share with unauthorized individuals." \
--template-color-primary "#6241c5" \
--template-color-secondary "#b2b2b2" \
--template-button "Log In" \
-r mappings_editor/
- name: Ensure StatiCrypt ran # StatiCrypt will fail without warning; verify it created a directory
run: test -d encrypted
- name: Copy encrypted HTML files
run: rsync -Ir -v --include='*.html' --exclude='*.*' encrypted/mappings_editor .
- name: Set the branch name
run: mv mappings_editor "$BRANCH_NAME"
- name: Install Azure CLI
run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Delete old blobs
run: az storage blob delete-batch -s '$web' --pattern "$BRANCH_NAME/*"
- name: Upload to blob storage
run: az storage blob upload-batch -s . --pattern "$BRANCH_NAME/*" -d '$web'
- uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `This PR has been published to https://mappingseditor.z13.web.core.windows.net/${process.env['BRANCH_NAME']}/`,
})
# Uncomment for public release:
# github_pages:
# # This job only runs when committing or merging to main branch.
# if: github.ref_name == 'main'
# needs: web_site
# runs-on: ubuntu-latest
# environment:
# name: github-pages
# url: $\{\{ steps.deployment.outputs.page_url \}\}
# steps:
# - name: Setup Pages
# uses: actions/configure-pages@v2
# - name: Download Web Site
# uses: actions/download-artifact@v3
# with:
# name: mappings_editor
# path: mappings_editor
# - name: Upload artifact
# uses: actions/upload-pages-artifact@v1
# with:
# path: ./mappings_editor
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v1