Skip to content

chore: don't hardcode repository owner for docker image (#38) #84

chore: don't hardcode repository owner for docker image (#38)

chore: don't hardcode repository owner for docker image (#38) #84

---
name: Build
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
merge_group:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
jobs:
build-c2-build:
name: "Build ${{ matrix.image-name }} builder"
runs-on: ubuntu-latest
strategy:
matrix:
include:
# The Dockerfile file name will be inferred from the image-name parameter
# If the image-name is chatterino2-xd, the Dockerfile it will look for is Dockerfile_chatterino2-xd
- os: ubuntu-22.04
image-name: chatterino2-build-ubuntu-22.04
- os: ubuntu-24.04
image-name: chatterino2-build-ubuntu-24.04
- os: ubuntu-26.04
image-name: chatterino2-build-ubuntu-26.04
env:
C2_PLUGINS: "ON"
C2_BUILD_WITH_QT6: "ON"
IMAGE_NAME: "${{ github.repository_owner }}/${{ matrix.image-name }}"
steps:
- name: Lowercase Repo Owner in IMAGE_NAME env var
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> "${GITHUB_ENV}"
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v6
with:
repository: "Chatterino/chatterino2"
submodules: recursive
- uses: actions/checkout@v6
with:
path: "chatterino-docker"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log into docker registry
if: github.event_name == 'push'
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
uses: docker/build-push-action@v7
with:
context: .
push: false
load: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
file: ./chatterino-docker/Dockerfile_${{ matrix.image-name }}
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}
cache-to: type=inline
# Build Chatterino master with this docker image
- name: Test docker image
run: |
docker run \
-v "${PWD}:/srv" \
-w"/srv" \
-e C2_PLUGINS \
-e C2_BUILD_WITH_QT6 \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \
./.CI/full-ubuntu-build.sh
- name: Push docker image
if: github.event_name == 'push'
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
file: ./chatterino-docker/Dockerfile_${{ matrix.image-name }}
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}
cache-to: type=inline
build-c2-generic:
name: "Build ${{ matrix.image-name }} generic"
runs-on: ubuntu-latest
strategy:
matrix:
include:
# The Dockerfile file name will be inferred from the image-name parameter
# If the image-name is chatterino2-xd, the Dockerfile it will look for is Dockerfile_chatterino2-xd
- image-name: chatterino2-test-httpbox
env:
IMAGE_NAME: "${{ github.repository_owner }}/${{ matrix.image-name }}"
steps:
- name: Lowercase Repo Owner in IMAGE_NAME env var
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> "${GITHUB_ENV}"
- uses: actions/checkout@v6
with:
path: "chatterino-docker"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log into docker registry
if: github.event_name == 'push'
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
uses: docker/build-push-action@v7
with:
context: .
push: false
load: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
file: ./chatterino-docker/Dockerfile_${{ matrix.image-name }}
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}
cache-to: type=inline
- name: Push docker image
if: github.event_name == 'push'
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
file: ./chatterino-docker/Dockerfile_${{ matrix.image-name }}
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}
cache-to: type=inline