diff --git a/.github/workflows/release-pages-production.yaml b/.github/workflows/release-pages-production.yaml new file mode 100644 index 0000000..379a7ce --- /dev/null +++ b/.github/workflows/release-pages-production.yaml @@ -0,0 +1,84 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Release to DEG-Mods.github.io + +on: + push: + branches: ['master'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Allow one concurrent deployment +concurrency: + group: 'pages' + cancel-in-progress: true + +jobs: + build: + environment: + name: github-pages + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + - name: Install dependencies + run: npm ci + - name: Create .env File + run: | + echo "VITE_APP_RELAY=${{ vars.VITE_APP_RELAY }}" >> .env + echo "VITE_ADMIN_NPUBS=${{ vars.VITE_ADMIN_NPUBS }}" >> .env + echo "VITE_FALLBACK_GAME_IMAGE=${{ vars.VITE_FALLBACK_GAME_IMAGE }}" >> .env + echo "VITE_FALLBACK_MOD_IMAGE=${{ vars.VITE_FALLBACK_MOD_IMAGE }}" >> .env + echo "VITE_REPORTING_NPUB=${{ vars.VITE_REPORTING_NPUB }}" >> .env + cat .env + - name: Build + run: npm run build + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: './dist' + + deploy: + environment: + name: github-pages + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + repository: ${{ vars.ORGANIZATION_NAME }}/${{ vars.REPOSITORY_NAME }} + path: ${{ vars.REPOSITORY_NAME }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Clear target repo + run: | + rm -rf ${{ vars.REPOSITORY_NAME }}/* + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: ./dist + + - name: Prepare files + run: | + cp -r dist/* ${{ vars.REPOSITORY_NAME }}/ + echo ${{ vars.CUSTOM_DOMAIN }} > ${{ vars.REPOSITORY_NAME }}/CNAME + touch ${{ vars.REPOSITORY_NAME }}/.nojekyll + + - name: Commit and push + run: | + cd ${{ vars.REPOSITORY_NAME }} + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m 'Deploy from source repo' + git push origin main diff --git a/.github/workflows/release-pages-staging.yaml b/.github/workflows/release-pages-staging.yaml deleted file mode 100644 index cf58671..0000000 --- a/.github/workflows/release-pages-staging.yaml +++ /dev/null @@ -1,63 +0,0 @@ -# Simple workflow for deploying static content to GitHub Pages -name: Deploy static content to Pages - -on: - push: - branches: ['staging'] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets the GITHUB_TOKEN permissions 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: - build: - environment: - name: github-pages-staging - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: 'npm' - - name: Install dependencies - run: npm ci - - name: Create .env File - run: | - echo "VITE_APP_RELAY=${{ vars.VITE_APP_RELAY }}" >> .env - echo "VITE_ADMIN_NPUBS=${{ vars.VITE_ADMIN_NPUBS }}" >> .env - echo "VITE_FALLBACK_GAME_IMAGE=${{ vars.VITE_FALLBACK_GAME_IMAGE }}" >> .env - echo "VITE_FALLBACK_MOD_IMAGE=${{ vars.VITE_FALLBACK_MOD_IMAGE }}" >> .env - echo "VITE_REPORTING_NPUB=${{ vars.VITE_REPORTING_NPUB }}" >> .env - cat .env - - name: Build - run: npm run build -- --base=https://deg-mods.github.io/DEGMods/ - - name: Setup Pages - uses: actions/configure-pages@v4 - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: './dist' - - deploy: - environment: - name: github-pages-staging - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4