Skip to content

chore: Create dependapot.yml #97

chore: Create dependapot.yml

chore: Create dependapot.yml #97

Workflow file for this run

name: build
on:
push:
branches:
- dev
tags:
- v*
pull_request: {}
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js from 'package.json'
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'yarn'
- name: Build
run: |
yarn install
yarn run lint
yarn run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: github.event_name == 'push' && (github.ref_name == 'dev' || github.ref_type == 'tag')
with:
name: dist-${{ github.ref_name }}
path: dist
retention-days: 1
docker:
runs-on: ubuntu-latest
needs: build
# Only publish dev branch and tags
if: github.event_name == 'push' && (github.ref_name == 'dev' || github.ref_type == 'tag')
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get artifact from Build job
uses: actions/download-artifact@v4
with:
name: dist-${{ github.ref_name }}
path: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Define vars
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref_name }}" | tr '[A-Z]' '[a-z]')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "dev" ] && VERSION=latest
echo "IMAGE_ID=$IMAGE_ID"
echo "VERSION=$VERSION"
# Register variables
echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build and Publish Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max