Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Docker Build and Push

on:
push:
branches:
- master

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Get short commit SHA
id: commit
run: echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_HUB_USERNAME }}/faucet
tags: |
type=raw,value=latest
type=raw,value=latest-${{ steps.commit.outputs.SHORT_SHA }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,image=${{ secrets.DOCKER_HUB_USERNAME }}/faucet:latest
cache-to: type=inline

- name: Display Docker image tags
run: |
echo "=========================================="
echo "✅ Docker image built and pushed successfully!"
echo "=========================================="
echo ""
echo "📦 Image: ${{ secrets.DOCKER_HUB_USERNAME }}/faucet"
echo ""
echo "🏷️ Available tags:"
echo " • latest"
echo " • latest-${{ steps.commit.outputs.SHORT_SHA }}"
echo ""
echo "📋 Pull commands:"
echo " docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/faucet:latest"
echo " docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/faucet:latest-${{ steps.commit.outputs.SHORT_SHA }}"
echo ""
echo "🔗 Commit: ${{ github.sha }}"
echo " Short SHA: ${{ steps.commit.outputs.SHORT_SHA }}"
echo "=========================================="
42 changes: 42 additions & 0 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR Test

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm test
Loading