This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish image | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
BUILD_DEBIAN_TAG: bookworm-20240311-slim | |
BUILD_TAG: ghcr.io/${{ github.repository_owner }}/redbean-build:${{ github.sha }} | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'pull_request' }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Log in to Docker Hub | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USR }} | |
password: ${{ secrets.GH_PAT }} | |
logout: true | |
- name: Build and export build image | |
uses: docker/[email protected] | |
with: | |
load: true | |
push: false | |
context: . | |
file: ./Dockerfile.redbean-build | |
build-args: BUILD_DEBIAN_TAG=${{ env.BUILD_DEBIAN_TAG }} | |
tags: | | |
${{ env.BUILD_TAG }} | |
- name: Build and push final image | |
uses: docker/[email protected] | |
with: | |
push: true | |
context: . | |
file: ./Dockerfile.redbean-scratch | |
build-args: | | |
GIT_REPO_OWNER=${{ github.repository_owner }} | |
BUILD_TAG=${{ github.sha }} | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/redbean:latest |