Skip to content

Ci: Add GitHub Actions CI/CD pipeline. #2

Ci: Add GitHub Actions CI/CD pipeline.

Ci: Add GitHub Actions CI/CD pipeline. #2

Workflow file for this run

name: CI
permissions:
contents: read
packages: write
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
NODE_VERSION: "22"
jobs:
# --------
# CHECKS
# --------
checks:
name: Lint, Build and Test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Enable Corepack
run: corepack enable
- name: Install Dependencies
run: yarn install --immutable
- name: Lint
run: yarn lint
- name: Build
run: yarn build
- name: Test
run: yarn test
# -----------------
# BUILD AND PUBLISH
# -----------------
build-and-publish:
name: Build and Publish
needs: checks
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/twogiants/console-functions-plugin:latest
ghcr.io/twogiants/console-functions-plugin:sha-${{ github.sha }}