From 1137662ab01b8343713c8b334971ec2fe211e2c9 Mon Sep 17 00:00:00 2001 From: Saul Burgess Date: Tue, 16 Sep 2025 17:49:45 +0100 Subject: [PATCH 1/2] Adds release and nightly github actions to build docker images --- .github/workflows/ghcr-build-nightly.yaml | 59 +++++++++++++++++++++++ .github/workflows/ghcr-build-release.yaml | 58 ++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 .github/workflows/ghcr-build-nightly.yaml create mode 100644 .github/workflows/ghcr-build-release.yaml diff --git a/.github/workflows/ghcr-build-nightly.yaml b/.github/workflows/ghcr-build-nightly.yaml new file mode 100644 index 00000000..302364ad --- /dev/null +++ b/.github/workflows/ghcr-build-nightly.yaml @@ -0,0 +1,59 @@ +name: Build and Push Nightly Image + +on: + push: + branches: ["nightly"] + +env: + REGISTRY: ghcr.io + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + fetch-depth: 0 # Fetch all history for all tags and branches + + - name: Lowercase the repo name + run: | + echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=nightly + flavor: | + latest=false + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/ghcr-build-release.yaml b/.github/workflows/ghcr-build-release.yaml new file mode 100644 index 00000000..43e3df7e --- /dev/null +++ b/.github/workflows/ghcr-build-release.yaml @@ -0,0 +1,58 @@ +name: Build and Push Release Image + +on: + push: + tags: ["v*"] + +env: + REGISTRY: ghcr.io + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + fetch-depth: 0 # Fetch all history for all tags and branches + + - name: Lowercase the repo name + run: | + echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=raw,value=latest + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max From e7537dd6f2387ac5c9a005e84b6af0577c641346 Mon Sep 17 00:00:00 2001 From: Saul Burgess Date: Tue, 16 Sep 2025 17:50:04 +0100 Subject: [PATCH 2/2] Removes old dockerhub build --- .github/workflows/docker-publish.yml.disabled | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 .github/workflows/docker-publish.yml.disabled diff --git a/.github/workflows/docker-publish.yml.disabled b/.github/workflows/docker-publish.yml.disabled deleted file mode 100644 index 11e91296..00000000 --- a/.github/workflows/docker-publish.yml.disabled +++ /dev/null @@ -1,64 +0,0 @@ -name: Build and Publish Docker Image - -on: - push: - branches: - - '**' - pull_request: - types: [closed] - -env: - REPO_OWNER: ${{ github.repository_owner }} - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Set environment variables - run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - - name: Build Docker image - uses: docker/build-push-action@v2 - with: - context: . - push: false - tags: ghcr.io/${{ env.REPO_OWNER }}/stationeers-server-ui:latest - - publish: - if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' - needs: build - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Set environment variables - run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Docker image - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: ghcr.io/${{ env.REPO_OWNER }}/stationeers-server-ui:latest - - - name: Log out from GitHub Container Registry - run: docker logout ghcr.io \ No newline at end of file