Skip to content

chore(deps): update all non-major dependencies #176

chore(deps): update all non-major dependencies

chore(deps): update all non-major dependencies #176

name: Build and deploy projects-dashboard
on:
push:
branches: [main]
paths:
- "projects-dashboard/**"
- ".github/workflows/projects-dashboard.yml"
pull_request:
branches: [main]
paths:
- "projects-dashboard/**"
- ".github/workflows/projects-dashboard.yml"
workflow_dispatch:
# Allow this job to clone the repo and write comments
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
outputs:
path: ${{ steps.get-target-folder.outputs.path }}
steps:
- name: Checkout your repository using git
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Get target folder
id: get-target-folder
env:
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_REF_NAME: ${{ github.ref_name }}
PR_NUMBER: ${{ github.event.number }}
run: |
if [ "$GITHUB_HEAD_REF" != "" ]; then
# This is a pull request
BRANCH=$GITHUB_HEAD_REF
else
# This is a push to a branch
BRANCH=$GITHUB_REF_NAME
fi
TARGET_PATH=projects-dashboard
if [ "$BRANCH" != "main" ]; then
TARGET_PATH=projects-dashboard-preview-pr-$PR_NUMBER
fi
echo "path=$TARGET_PATH" >> $GITHUB_OUTPUT
# replace basepath in astro.config.mjs using $PATH
sed -i "s|ospo/projects-dashboard|ospo/${TARGET_PATH}|g" projects-dashboard/astro.config.mjs
cat projects-dashboard/astro.config.mjs
- name: Prepare preview path
if: github.event_name == 'pull_request'
run: |
npm install -g pnpm
- name: Install, build, and upload your site
uses: withastro/action@56781b97402ce0487b7e61ce2cb960c0e2cc5289 # v3
with:
path: ./projects-dashboard
node-version: 20
package-manager: pnpm@9
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Download Artifacts
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
with:
name: github-pages
path: projects-dashboard-site
- name: Unzip site artifact
run: |
cd ./projects-dashboard-site
tar -xvf artifact.tar .
rm artifact.tar
cd ..
ls -R ./projects-dashboard-site
- name: Deploy to GitHub Pages
id: deployment
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4
with:
branch: gh-pages
folder: projects-dashboard-site
target-folder: ${{ needs.build.outputs.path }}
# Add a comment to the PR with the link to the deployed site
- name: Add preview comment to PR
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
comment_tag: preview-deploy
message: |
Site preview deployed to: https://block.github.io/ospo/${{ needs.build.outputs.path }}
_(execution **[#${{ github.run_id }}](https://github.com/block/ospo/actions/runs/${{ github.run_id }})** / attempt **${{ github.run_attempt }}**)_