Skip to content

Commit

Permalink
feat: add gh pages deployment to track the version of future artifacs…
Browse files Browse the repository at this point in the history
… on a reachable place
  • Loading branch information
fabianbormann committed Aug 6, 2023
1 parent 5252325 commit a170147
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 6 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Upload cardano-peer-connect Bundle to GitHub Pages

on:
push:
branches:
- main

workflow_dispatch:

jobs:
upload-cardano-peer-connect-to-gh-pages:
if: "contains(github.event.head_commit.message, 'release-please--branches--main')"
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v3

- name: 🫡 Setup node
uses: actions/setup-node@v1
with:
node-version: 18.12.0

- name: 🧘‍♀️ Download dependencies
run: npm ci

- name: 📦 Build the cardano-peer-connect bundle
run: npm run build

- name: 👀 Lookup version
run: |
echo "VERSION=$(sed -n 's/.*\"version\": *\"\([^\"]*\)\".*/\1/p' package.json)" >> $GITHUB_ENV
- name: 🎨 Create version folder
run: mkdir -p ${{ env.VERSION }}

- name: 💃🏻 Move files into the version folder
run: |
mv dist/index.js ${{ env.VERSION }}/index.js
mv dist/index.js.map ${{ env.VERSION }}/index.js.map
mv dist/index.js.LICENSE.txt ${{ env.VERSION }}/index.js.LICENSE.txt
- name: 📅 Publish latest version on gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
BRANCH: gh-pages
folder: ${{ env.VERSION }}
target-folder: latest/

- name: 🥁 Publish explicit version on gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
BRANCH: gh-pages
folder: ${{ env.VERSION }}
target-folder: ${{ env.VERSION }}/
3 changes: 0 additions & 3 deletions bundle.min.js

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
"module": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"bundle": "npm run build && cp dist/index.js bundle.min.js",
"build": "webpack && tsc --emitDeclarationOnly",
"cy:run": "cypress run",
"test": "npm run bundle && cypress run"
"test": "npm run build && cypress run"
},
"keywords": [
"WebRTC",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test_dApp.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../../bundle.min.js"></script>
<script src="../../dist/index.js"></script>
<title>Test dApp</title>
</head>

Expand Down

0 comments on commit a170147

Please sign in to comment.