|
| 1 | +# Simple workflow for deploying static content to GitHub Pages |
| 2 | +name: Deploy |
| 3 | + |
| 4 | +on: |
| 5 | + # Allows you to run this workflow manually from the Actions tab |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | + # Triggered from mainnet |
| 9 | + repository_dispatch: |
| 10 | + types: [triggered_from_mainnet] |
| 11 | + |
| 12 | +# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + pages: write |
| 16 | + id-token: write |
| 17 | + attestations: write |
| 18 | + |
| 19 | +# Allow one concurrent deployment |
| 20 | +concurrency: |
| 21 | + group: 'pages' |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + deploy: |
| 26 | + environment: |
| 27 | + name: github-pages |
| 28 | + url: ${{ steps.deployment.outputs.page_url }} |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - name: Checkout 'test' branch of Main Repository |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + repository: SwapMarket/swapmarket.github.io |
| 35 | + ref: test |
| 36 | + |
| 37 | + - name: Set up Node |
| 38 | + uses: actions/setup-node@v4 |
| 39 | + with: |
| 40 | + node-version: 20 |
| 41 | + cache: 'npm' |
| 42 | + |
| 43 | + - name: Install dependencies |
| 44 | + run: npm ci |
| 45 | + |
| 46 | + - name: Update vite.config.mjs |
| 47 | + run: | |
| 48 | + sed -i 's|base: "/",*$|base: "/testnet/",|g' vite.config.mjs |
| 49 | +
|
| 50 | + - name: Update index.tsx |
| 51 | + run: | |
| 52 | + sed -i 's|base = "/";|base = "/testnet/";|g' src/index.tsx |
| 53 | +
|
| 54 | + - name: Copy config |
| 55 | + run: npm run testnet |
| 56 | + |
| 57 | + - name: Build |
| 58 | + run: npm run build |
| 59 | + |
| 60 | + - name: Setup Pages |
| 61 | + uses: actions/configure-pages@v4 |
| 62 | + |
| 63 | + - name: Attest build provenance |
| 64 | + uses: actions/attest-build-provenance@v1 |
| 65 | + with: |
| 66 | + subject-path: '${{ github.workspace }}/dist' |
| 67 | + |
| 68 | + - name: Upload artifact |
| 69 | + uses: actions/upload-pages-artifact@v3 |
| 70 | + with: |
| 71 | + path: './dist' |
| 72 | + |
| 73 | + - name: Deploy to GitHub Pages |
| 74 | + id: deployment |
| 75 | + uses: actions/deploy-pages@v4 |
0 commit comments