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
76 changes: 75 additions & 1 deletion .github/workflows/publish-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,47 @@ name: Publish Template
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
publish-staging:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push staging template
uses: docker/build-push-action@v5
with:
context: .
file: ./src/dbt-fusion/.devcontainer/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}/dbt-fusion:pr-${{ github.event.pull_request.number }}
ghcr.io/${{ github.repository }}/dbt-fusion:staging

publish:
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -35,4 +72,41 @@ jobs:
file: ./src/dbt-fusion/.devcontainer/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository }}/dbt-fusion:latest
tags: ghcr.io/${{ github.repository }}/dbt-fusion:latest

cleanup-pr-images:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
needs: publish
runs-on: ubuntu-latest
permissions:
packages: write

steps:
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Delete PR-specific image
run: |
# Delete PR-specific tag
docker run --rm \
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-e PACKAGE_NAME=dbt-fusion \
-e PACKAGE_TYPE=container \
-e PACKAGE_OWNER=${{ github.repository_owner }} \
-e PACKAGE_VERSION=pr-${{ github.event.pull_request.number }} \
ghcr.io/actions/github-script@v6

# Delete staging tag
docker run --rm \
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-e PACKAGE_NAME=dbt-fusion \
-e PACKAGE_TYPE=container \
-e PACKAGE_OWNER=${{ github.repository_owner }} \
-e PACKAGE_VERSION=staging \
ghcr.io/actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion src/dbt-fusion/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Use the official Python image as the base image
FROM python:3.12-slim

# Install system dependencies (i.e. git, curl)
# Install system dependencies (i.e. git, curl, xdg-utils)
RUN apt-get update && apt-get install -y \
git \
curl \
xdg-utils \
&& rm -rf /var/lib/apt/lists/*

# Install uv using pip
Expand Down
27 changes: 3 additions & 24 deletions src/dbt-fusion/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
{
"name": "dbt Fusion",
"version": "1.0.3",
"description": "A development container for dbt projects that use the new fusion engine with the official dbt VS Code extension. ",
"description": "A development container for dbt projects that use the new fusion engine with the official dbt VS Code extension.",
"documentationURL": "https://github.com/jairus-m/dbt-fusion-devcontainer",
"licenseURL": "https://github.com/jairus-m/dbt-fusion-devcontainer/blob/main/LICENSE",
"options": {
"imageVariant": {
"type": "string",
"description": "Debian OS version (use bullseye on local arm64/Apple Silicon, bookworm elsewhere)",
"proposals": [
"bullseye",
"bookworm"
],
"default": "bullseye"
},
"pythonVersion": {
"type": "string",
"description": "Python version to use",
"proposals": [
"3.12",
"3.11",
"3.10"
],
"default": "3.12"
}
}
}
"licenseURL": "https://github.com/jairus-m/dbt-fusion-devcontainer/blob/main/LICENSE"
}
3 changes: 3 additions & 0 deletions test/dbt-fusion/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ docker run --rm dbt-fusion-test uv --version
# Test git installation
docker run --rm dbt-fusion-test git --version

# Test xdg-utils installation
docker run --rm dbt-fusion-test xdg-open --version

echo "All tests passed!"