Update _index.md #2709
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 3 # Fetch all history for .GitInfo and .Lastmod | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- uses: actions/[email protected] | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node3-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node3- | |
- run: npm ci | |
- name: Lint | |
run: npm run lint | |
- name: Build | |
run: npm run build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: website | |
path: ./public | |
image: | |
needs: build | |
# only on main and dev branch | |
if: startsWith(github.ref, 'refs/heads/main') || github.ref == 'refs/heads/dev' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: cmu-delphi-deploy-machine | |
password: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }} | |
- name: Build Image | |
env: | |
DEVOPS_DOCKER_FILE: ./devops/Dockerfile | |
run: | | |
docker build -t repo --file ${DEVOPS_DOCKER_FILE} . | |
- name: Resolve Tag | |
id: tagname | |
run: | | |
baseRef="${GITHUB_REF#*/}" | |
imageTag="${baseRef#*/}" | |
if [ "$imageTag" = "main" ] ; then | |
imageTag="latest" | |
fi | |
echo "::set-output name=tag::$imageTag" | |
echo "::set-output name=repo::ghcr.io/${{ github.repository }}" | |
- name: Push Dev Tag | |
run: | | |
docker tag repo ${{ steps.tagname.outputs.repo }}:${{ steps.tagname.outputs.tag }} | |
docker push ${{ steps.tagname.outputs.repo }}:${{ steps.tagname.outputs.tag }} | |
- name: Extract version | |
if: startsWith(github.ref, 'refs/heads/main') | |
id: extract_version | |
run: node -pe "'::set-output name=version::' + require('./package.json').version" | |
- name: Trigger Webhook | |
run: | | |
# trigger a webhook update | |
curl -H "Authorization: Bearer ${{ secrets.DELPHI_DEPLOY_WEBHOOK_TOKEN }}" \ | |
-X POST ${{ secrets.DELPHI_DEPLOY_WEBHOOK_URL }} \ | |
-H "Content-Type: application/x-www-form-urlencoded" \ | |
-d "repository=${{ steps.tagname.outputs.repo }}&tag=${{ steps.tagname.outputs.tag }}" | |
- name: Push Version Tag Tag | |
if: startsWith(github.ref, 'refs/heads/main') | |
run: | | |
docker tag repo ${{ steps.tagname.outputs.repo }}:v${{ steps.extract_version.outputs.version }} | |
docker push ${{ steps.tagname.outputs.repo }}:v${{ steps.extract_version.outputs.version }} |