chore: add package option to publish workflow #64
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
name: Build and Upload Core Bundle or cardano-connect.js to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
upload-core-bundle: | |
if: "contains(github.event.head_commit.message, 'release-please--branches--main--components--cardano-connect-with-wallet-core')" | |
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: 📦 Make bundle | |
run: npm run bundle:core | |
- name: 👀 Lookup version | |
run: | | |
echo "VERSION=$(sed -n 's/.*\"version\": *\"\([^\"]*\)\".*/\1/p' core/package.json)" >> $GITHUB_ENV | |
- name: 🎨 Create bundle folder | |
run: mkdir -p core/bundle-${{ env.VERSION }} | |
- name: 💃🏻 Move files into the bundle folder | |
run: | | |
mv core/dist/index.js core/bundle-${{ env.VERSION }}/index.js | |
mv core/dist/index.js.map core/bundle-${{ env.VERSION }}/index.js.map | |
- name: 📅 Publish latest bundle on gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
BRANCH: gh-pages | |
folder: core/bundle-${{ env.VERSION }} | |
target-folder: bundle-latest/ | |
- name: 🥁 Publish bundle with version on gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
BRANCH: gh-pages | |
folder: core/bundle-${{ env.VERSION }} | |
target-folder: bundle-${{ env.VERSION }}/ | |
upload-cardano-connect-js: | |
if: "contains(github.event.head_commit.message, 'release-please--branches--main--components--cardano-connect-js')" | |
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: 📦 Make bundle | |
run: npm run bundle:html | |
- name: 👀 Lookup version | |
run: | | |
echo "VERSION=$(cat html/version.txt)" >> $GITHUB_ENV | |
- name: 📅 Publish latest cardano-connect-js lib on gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
BRANCH: gh-pages | |
folder: html | |
target-folder: cardano-connect-latest/ | |
- name: 🥁 Publish bundle with version on gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
BRANCH: gh-pages | |
folder: html | |
target-folder: cardano-connect-${{ env.VERSION }}/ |