Skip to content

add insertion timer #268

add insertion timer

add insertion timer #268

Workflow file for this run

name: Docker
on:
push:
branches:
- "main"
jobs:
test:
name: "Test (${{ matrix.scraper }})"
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 1
matrix:
scraper:
# - nss
- libcal
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "16"
- name: Install dependencies
run: npm install
working-directory: ${{ matrix.scraper }}
- name: Run scraper
run: npm run scrape
working-directory: ${{ matrix.scraper }}
env:
HASURAGRES_URL: https://graphql.csesoc.app
HASURAGRES_API_KEY: ${{ secrets.HASURAGRES_API_KEY }}
build:
name: "Build image (${{ matrix.scraper }})"
needs: [ test ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
scraper: [ nss, libcal ]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
platforms: linux/amd64
file: ${{ matrix.scraper }}.dockerfile
tags: |
ghcr.io/devsoc-unsw/freerooms-${{ matrix.scraper }}-scraper:${{ github.sha }}
ghcr.io/devsoc-unsw/freerooms-${{ matrix.scraper }}-scraper:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
name: Deploy (CD)
runs-on: ubuntu-latest
needs: [ build ]
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: csesoc/deployment
ref: migration
token: ${{ secrets.GH_TOKEN }}
- name: Install yq
uses: mikefarah/[email protected]
- name: Update deployment
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git config user.name "CSESoc CD"
git config user.email "[email protected]"
git checkout -b update/freerooms-scrapers/${{ github.sha }}
yq -i '.spec.jobTemplate.spec.template.spec.containers[0].image = "ghcr.io/devsoc-unsw/freerooms-nss-scraper:${{ github.sha }}"' projects/nss-scraper/nss-scraper.yml
yq -i '.spec.jobTemplate.spec.template.spec.containers[0].image = "ghcr.io/devsoc-unsw/freerooms-libcal-scraper:${{ github.sha }}"' projects/libcal-scraper/libcal-scraper.yml
git add .
git commit -m "feat(freerooms-scrapers): update images"
git push -u origin update/freerooms-scrapers/${{ github.sha }}
gh pr create -B migration --title "feat(freerooms-scrapers): update images" --body "Updates the images for the nss-scraper and libcal-scraper deployments to commit devsoc-unsw/freerooms-scrapers@${{ github.sha }}." > URL
gh pr merge $(cat URL) --squash -d