diff --git a/.github/workflows/deploy.js b/.github/workflows/deploy.js index 43b1688..57047ca 100644 --- a/.github/workflows/deploy.js +++ b/.github/workflows/deploy.js @@ -4,6 +4,8 @@ process.removeAllListeners('warning'); process.on('SIGTERM', () => process.exit()); process.on('SIGINT', () => process.exit()); +const { BASE_HREF = '' } = process.env + import { readFile, writeFile, readdir, cp, rm, @@ -37,7 +39,7 @@ const fixOrCopy = async ( html: [ [ '', - '' + `` ], [ '../node_modules/', @@ -99,7 +101,7 @@ try { html: [ [ '', - '' + `` ], [ '../node_modules/', diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..4c0f255 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,52 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master","feat/*"] + + # 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 one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +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@v3 + - name: Setup Pages + uses: actions/configure-pages@v2 + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + check-latest: true + node-version: 20 + cache: 'npm' + - run: npm ci + - run: npm run deploy + env: + BASE_HREF: 'wallet-ui/' + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + # Upload entire repository + path: './dist/' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index b235752..41ad5d3 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,37 +1,24 @@ -# Simple workflow for deploying static content to GitHub Pages -name: Deploy static content to Pages +name: Deploy static site on: - # Runs on pushes targeting the default branch push: branches: ["master","feat/*"] - - # 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 one concurrent deployment concurrency: - group: "pages" + group: "static" cancel-in-progress: true jobs: - # Single deploy job since we're just deploying deploy: environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + name: wallet + url: ${{ vars.WEBSITE }} runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - name: Setup Pages - uses: actions/configure-pages@v2 - name: Setup Node.js environment uses: actions/setup-node@v3 with: @@ -43,8 +30,22 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: - # Upload entire repository path: './dist/' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 + - shell: bash + env: + SSH_CONFIG: ${{ secrets.SSH_CONFIG }} + SSH_IDENTITY: ${{ secrets.SSH_IDENTITY }} + SSH_IDENTITY_FILE: ${{ secrets.SSH_IDENTITY_FILE }} + run: | + touch ~/.ssh/config + echo $SSH_CONFIG >> ~/.ssh/config + echo $SSH_IDENTITY >> $SSH_IDENTITY_FILE + - name: Adding Known Hosts + run: ssh-keyscan -H ${{ secrets.SSH_HOSTNAME }} >> ~/.ssh/known_hosts + - name: Deploy with rsync + env: + GHREF: ${{ GITHUB_REF_NAME }} + RMFEAT: "feat/" + run: | + BRANCH=${GHREF//$RMFEAT/} + rsync -avhPz ./dist/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOSTNAME }}:~/branches/${BRANCH}