fix: use correct docker registry and image name
This commit is contained in:
@@ -22,16 +22,15 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Use GHCR or your own registry
|
# Use your existing Docker registry
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: docker.notsosm.art
|
||||||
IMAGE_NAME: ${{ github.repository }}/ci-runner
|
IMAGE_NAME: euchre-camp-ci-runner
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-ci-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
# Skip if this is an auto-generated version bump commit
|
||||||
contents: read
|
if: "!contains(github.event.head_commit.message, 'chore: bump version')"
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -40,42 +39,41 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to Container Registry
|
- name: Build CI image
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
tags: |
|
|
||||||
type=sha,prefix={{branch}}-
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
|
|
||||||
- name: Build and push CI image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile.ci
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: Update workflow documentation
|
|
||||||
run: |
|
run: |
|
||||||
echo "CI Image built and pushed successfully!"
|
docker build \
|
||||||
echo ""
|
-f Dockerfile.ci \
|
||||||
echo "Available tags:"
|
-t ${{ env.IMAGE_NAME }}:latest \
|
||||||
echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
|
-t ${{ env.IMAGE_NAME }}:$(git rev-parse --short HEAD) \
|
||||||
echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
|
.
|
||||||
|
|
||||||
|
- name: Test CI image
|
||||||
|
run: |
|
||||||
|
docker run --rm \
|
||||||
|
${{ env.IMAGE_NAME }}:latest \
|
||||||
|
sh -c "node --version && npm --version && npx prisma --version"
|
||||||
|
|
||||||
|
- name: Push to registry
|
||||||
|
run: |
|
||||||
|
echo "Pushing to ${{ env.REGISTRY }}..."
|
||||||
|
# Check if we can authenticate to the registry using DOCKER_LOGIN and DOCKER_PASSWORD secrets
|
||||||
|
if [ -n "${{ secrets.DOCKER_LOGIN }}" ] && [ -n "${{ secrets.DOCKER_PASSWORD }}" ]; then
|
||||||
|
if docker login ${{ env.REGISTRY }} -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }} 2>/dev/null; then
|
||||||
|
docker tag ${{ env.IMAGE_NAME }}:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
echo "Successfully pushed CI image to ${{ env.REGISTRY }}"
|
||||||
|
else
|
||||||
|
echo "Warning: Docker login failed with provided credentials"
|
||||||
|
echo "CI image built locally but not pushed to registry"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Warning: DOCKER_LOGIN or DOCKER_PASSWORD secrets not configured"
|
||||||
|
echo "CI image built locally but not pushed to registry"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Show usage instructions
|
||||||
|
run: |
|
||||||
|
echo "CI Image built successfully!"
|
||||||
echo ""
|
echo ""
|
||||||
echo "To use in workflows:"
|
echo "To use in workflows:"
|
||||||
echo " container:"
|
echo " container:"
|
||||||
|
|||||||
+2
-19
@@ -9,20 +9,13 @@ jobs:
|
|||||||
unit-tests:
|
unit-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: node:20-alpine
|
image: docker.notsosm.art/euchre-camp-ci-runner:latest
|
||||||
options: --user root
|
options: --user root
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install system dependencies
|
|
||||||
run: |
|
|
||||||
apk add --no-cache bash git
|
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: npm run test:run
|
run: npm run test:run
|
||||||
|
|
||||||
@@ -30,7 +23,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: unit-tests
|
needs: unit-tests
|
||||||
container:
|
container:
|
||||||
image: node:20-alpine
|
image: docker.notsosm.art/euchre-camp-ci-runner:latest
|
||||||
options: --user root
|
options: --user root
|
||||||
env:
|
env:
|
||||||
DATABASE_PROVIDER: sqlite
|
DATABASE_PROVIDER: sqlite
|
||||||
@@ -38,19 +31,9 @@ jobs:
|
|||||||
BETTER_AUTH_SECRET: test-secret-key-for-ci-only
|
BETTER_AUTH_SECRET: test-secret-key-for-ci-only
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install system dependencies
|
|
||||||
run: |
|
|
||||||
apk add --no-cache bash git
|
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Generate Prisma client
|
|
||||||
run: npx prisma generate
|
|
||||||
|
|
||||||
- name: Setup SQLite database
|
- name: Setup SQLite database
|
||||||
run: |
|
run: |
|
||||||
# Create SQLite database file
|
# Create SQLite database file
|
||||||
|
|||||||
@@ -9,21 +9,14 @@ jobs:
|
|||||||
unit-tests:
|
unit-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: node:20-alpine
|
image: docker.notsosm.art/euchre-camp-ci-runner:latest
|
||||||
options: --user root
|
options: --user root
|
||||||
# Skip if this is an auto-generated version bump commit (handled by release workflow)
|
# Skip if this is an auto-generated version bump commit (handled by release workflow)
|
||||||
if: "!contains(github.event.head_commit.message, 'chore: bump version')"
|
if: "!contains(github.event.head_commit.message, 'chore: bump version')"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install system dependencies
|
|
||||||
run: |
|
|
||||||
apk add --no-cache bash git
|
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: npm run test:run
|
run: npm run test:run
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
IMAGE_NAME="euchre-camp-ci"
|
IMAGE_NAME="euchre-camp-ci-runner"
|
||||||
TAG="${1:-latest}"
|
TAG="${1:-latest}"
|
||||||
|
|
||||||
echo "Building CI runner image..."
|
echo "Building CI runner image..."
|
||||||
@@ -37,8 +37,8 @@ echo "✅ CI image is ready to use!"
|
|||||||
echo ""
|
echo ""
|
||||||
echo "To use in GitHub Actions/Gitea Actions:"
|
echo "To use in GitHub Actions/Gitea Actions:"
|
||||||
echo " container:"
|
echo " container:"
|
||||||
echo " image: ${IMAGE_NAME}:${TAG}"
|
echo " image: docker.notsosm.art/${IMAGE_NAME}:${TAG}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "To push to registry:"
|
echo "To push to registry:"
|
||||||
echo " docker tag ${IMAGE_NAME}:${TAG} registry.example.com/${IMAGE_NAME}:${TAG}"
|
echo " docker tag ${IMAGE_NAME}:${TAG} docker.notsosm.art/${IMAGE_NAME}:${TAG}"
|
||||||
echo " docker push registry.example.com/${IMAGE_NAME}:${TAG}"
|
echo " docker push docker.notsosm.art/${IMAGE_NAME}:${TAG}"
|
||||||
|
|||||||
Reference in New Issue
Block a user