Add aria labels #2906
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: Node.js CI | |
on: | |
push: | |
branches: [master] | |
tags: ['v*'] | |
pull_request: | |
branches: [master] | |
# see https://gh.neting.ccmunity/t/treating-warnings-as-errors-because-process-env-ci-true/18032 | |
env: | |
CI: false | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build --if-present | |
- run: npm run start & | |
- name: Wait for the app to start | |
uses: iFaxity/wait-on-action@v1.1.0 | |
with: | |
resource: http://localhost:3000 | |
- name: Run tests | |
uses: nick-fields/retry@v3 | |
with: | |
max_attempts: 2 | |
retry_on: error | |
timeout_seconds: 240 | |
command: npm test | |
deploy-to-github-registry: | |
needs: [build_and_test] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }}-web | |
# when we run this action as depenabot, we need to give it write permissions to the package registry and to the statuses | |
permissions: | |
contents: read | |
packages: write | |
statuses: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# see https://github.com/docker/build-push-action/issues/513#issuecomment-987951050 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# it seems that cache is not giving any benefit in speed, lets keep it disabled for now | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=max | |
build-args: | | |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=true | |
DEPLOYMENT=dev | |
deploy_gh_pages: | |
runs-on: ubuntu-latest | |
needs: [build_and_test] | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install 🔧 | |
run: npm install | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'npm' | |
- name: webfactory/ssh-agent for dev 🖥️ | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
# Private SSH key to register in the SSH agent | |
ssh-private-key: ${{ secrets.WEBDEV }} | |
- name: Deploy to dev instance 🚀 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: | | |
git remote set-url origin git@github.com:yaptide/web_dev.git | |
npm run deploy -- -u "github-actions-bot <support+actions@github.com>" -r "git@github.com:yaptide/web_dev.git" | |
- name: webfactory/ssh-agent for production 🖥️ | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
# Private SSH key to register in the SSH agent | |
ssh-private-key: ${{ secrets.WEBPROD }} | |
- name: Deploy to prod instance 🚀 | |
# this action is being triggered on release tags (named v*) | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
run: | | |
git remote set-url origin git@github.com:yaptide/yaptide.github.io.git | |
npm run deploy -- -u "github-actions-bot <support+actions@github.com>" -r "git@github.com:yaptide/yaptide.github.io.git" |