Skip to content

Commit

Permalink
doc(core): gh action to publish gh page from demo/vanilla-js
Browse files Browse the repository at this point in the history
  • Loading branch information
dmidz committed Feb 16, 2024
1 parent fec40fc commit 8cacb54
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 4 deletions.
46 changes: 46 additions & 0 deletions .github/actions/upload-pages-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Upload GitHub Pages artifact"
description: "A composite action that prepares your static assets to be deployed to GitHub Pages"
author: "GitHub"
inputs:
name:
description: 'Artifact name'
required: false
default: 'github-pages'
path:
description: "Path of the directory containing the static assets."
required: true
default: "_site/"
retention-days:
description: "Duration after which artifact will expire in days."
required: false
default: "1"
outputs:
artifact_id:
description: "The ID of the artifact that was uploaded."
value: ${{ steps.upload-artifact.outputs.artifact-id }}
runs:
using: composite
steps:
- name: Archive artifact
shell: sh
if: runner.os == 'Linux'
run: |
echo ::group::Archive artifact
tar \
--dereference --hard-dereference \
--directory "$INPUT_PATH" \
-cvf "$RUNNER_TEMP/artifact.tar" \
--exclude=.git \
--exclude=.github \
"$INPUT_PATH"
echo ::endgroup::
env:
INPUT_PATH: ${{ inputs.path }}
- name: Upload artifact
id: upload-artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.name }}
path: ${{ runner.temp }}/artifact.tar
retention-days: ${{ inputs.retention-days }}
if-no-files-found: error
42 changes: 42 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifacts
uses: ./.github/actions/upload-pages-artifact
with:
path: 'demo/vanilla-js public'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 1 addition & 2 deletions demo/vanilla-js/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// ! change this import to @dmidz/tickschart
import { Chart, Fetcher, defaultTick, intervalsMs } from '../../dist';
import { Chart, Fetcher, defaultTick, intervalsMs } from 'https://cdn.jsdelivr.net/npm/@dmidz/tickschart/+esm';
import './style.css';

//__
Expand Down
3 changes: 1 addition & 2 deletions demo/vanilla-ts/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// ! change this import to @dmidz/tickschart
import { Chart, Fetcher, defaultTick, intervalsMs, type CandleTick } from '../../dist';
import { Chart, Fetcher, defaultTick, intervalsMs, type CandleTick } from '@dmidz/tickschart';
import './style.css';

//__
Expand Down

0 comments on commit 8cacb54

Please sign in to comment.