simplify release #359
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: Docker Image CI | |
on: | |
create: | |
workflow_dispatch: | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
branches: | |
- master | |
push: | |
paths-ignore: | |
- '**.md' | |
tags-ignore: | |
- '**' | |
branches: | |
- master | |
- fork/master | |
jobs: | |
code_check: | |
name: Code checks | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ludeeus/action-shellcheck@2.0.0 | |
env: | |
SHELLCHECK_OPTS: -x | |
- name: Install eclint | |
run: sudo npm install -g eclint | |
- name: Check EditorConfig compliance | |
run: eclint check $(git ls-files) | |
build_pr: | |
name: "Test Build Docker images" | |
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || ( github.event_name != 'create' && github.event_name != 'pull_request' && github.event_name != 'schedule' ) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: | |
- 'amd64' | |
- 'arm64' | |
env: | |
OWNER: '${{ github.repository_owner }}' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set lower case repository owner name | |
run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV" | |
- name: Enable docker multiarch | |
uses: docker/setup-qemu-action@v3 | |
- name: Fix docker logs | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: | | |
env.BUILDKIT_STEP_LOG_MAX_SIZE=-1 | |
env.BUILDKIT_STEP_LOG_MAX_SPEED=-1 | |
default-load=true | |
- name: Build the Docker images | |
run: make DISABLE_OPTIMIZATIONS=1 "OWNER=$OWNER_LC" build_${{matrix.arch}} | |
- name: Export image | |
run: make "OWNER=$OWNER_LC" export_${{matrix.arch}} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docker_image_${{matrix.arch}} | |
path: hbb_*.tar | |
build_release: | |
name: "Build release Docker images" | |
if: github.event_name == 'create' && github.event.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: | |
- 'amd64' | |
- 'arm64' | |
env: | |
TAG: ${{ github.event.ref }} | |
OWNER: '${{ github.repository_owner }}' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set lower case repository owner name | |
run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV" | |
- name: Check versions match (Makefile & git-tag) | |
run: | | |
MAKEFILE_VERSION=$(grep '^VERSION = ' Makefile | sed 's|.*= *||') | |
GIT_TAG_VERSION=$(sed 's|^rel-||' <<< "$TAG") | |
if [[ "$MAKEFILE_VERSION" != "$GIT_TAG_VERSION" ]]; then | |
echo "ERROR: version in Makefile ($MAKEFILE_VERSION) doesn't match Git tag ($GIT_TAG_VERSION)" | |
exit 1 | |
fi | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Enable docker multiarch | |
uses: docker/setup-qemu-action@v3 | |
- name: Fix docker logs | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: | | |
env.BUILDKIT_STEP_LOG_MAX_SIZE=-1 | |
env.BUILDKIT_STEP_LOG_MAX_SPEED=-1 | |
default-load=true | |
- name: Build the Docker image | |
run: make "OWNER=$OWNER_LC" build_${{matrix.arch}} | |
- name: Push the Docker image | |
run: make "OWNER=$OWNER_LC" push_${{matrix.arch}} |