matrix-art

An image gallery for Matrix
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-art.git
Log | Files | Refs | README | LICENSE

deploy-preview.yml (3094B)


      1 name: Build and Deploy Preview
      2 permissions:
      3   actions: none
      4   checks: none
      5   contents: read
      6   deployments: none
      7   id-token: none
      8   issues: none
      9   discussions: none
     10   packages: none
     11   pages: none
     12   pull-requests: write
     13   repository-projects: none
     14   security-events: none
     15   statuses: none
     16 on:
     17   pull_request:
     18 jobs:
     19   build-and-deploy:
     20     concurrency: ci-${{ github.ref }}
     21     runs-on: self-hosted
     22     steps:
     23       - name: Edit PR Description
     24         if: ${{ github.ref != 'refs/heads/main' }}
     25         uses: Beakyn/gha-comment-pull-request@2167a7aee24f9e61ce76a23039f322e49a990409
     26         env:
     27           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     28         with:
     29           pull-request-number: ${{ steps.readctx.outputs.prnumber }}
     30           description-message: |
     31             ----
     32             ⌛ Deploy Preview - Build in Progress
     33       - name: Checkout 🛎️
     34         if: ${{ github.ref != 'refs/heads/main' }}
     35         uses: actions/checkout@v3
     36       - uses: actions/setup-node@v3
     37         name: Setup node
     38         if: ${{ github.ref != 'refs/heads/main' }}
     39         with:
     40           node-version: "18"
     41       - name: Create env file
     42         if: ${{ github.ref != 'refs/heads/main' }}
     43         run: |
     44           echo "VITE_MATRIX_SERVER_URL=https://matrix.art.midnightthoughts.space" > .env.local
     45           echo "VITE_MATRIX_INSTANCE_ADMIN=@administrator:art.midnightthoughts.space" >> .env.local
     46           echo "VITE_MATRIX_ROOT_FOLDER=#Matrix_Art:art.midnightthoughts.space" >> .env.local
     47       - name: Install and Build 🔧
     48         if: ${{ github.ref != 'refs/heads/main' }}
     49         run: |
     50           apt-get update && apt-get install -y patch
     51           npm ci
     52           mv .github/package.json.patch node_modules/matrix-js-sdk/package.json.patch
     53           pushd node_modules/matrix-js-sdk/
     54           patch package.json < package.json.patch
     55           popd
     56           npx tsc && npx vite build --base /pr-${{ github.event.pull_request.number }}/
     57       - name: Deploy to gh-pages
     58         if: ${{ github.ref != 'refs/heads/main' }}
     59         uses: peaceiris/actions-gh-pages@v3
     60         with:
     61           deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
     62           publish_dir: ./dist
     63           destination_dir: ./pr-${{ github.event.pull_request.number }}
     64           cname: preview.art.midnightthoughts.space
     65           external_repository: MTRNord/matrix-art-preview
     66       - name: Edit PR Description
     67         if: ${{ github.ref != 'refs/heads/main' }}
     68         uses: Beakyn/gha-comment-pull-request@2167a7aee24f9e61ce76a23039f322e49a990409
     69         env:
     70           BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
     71           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     72         with:
     73           description-message: |
     74             ----
     75             😎 Browse the preview: https://preview.art.midnightthoughts.space/pr-${{ github.event.pull_request.number }} !
     76             🔍 Inspect the deploy log: ${{ env.BUILD_URL }}
     77             ⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.