Skip to content

Version bump

Version bump #36

name: Build and Push Docker Image
on:
push:
branches:
- master
tags:
- '*'
pull_request:
types:
- closed
branches:
- master
pull_request_target:
types:
- opened
- synchronize
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
VERSION: ""
jobs:
build-container:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read cli version from files
run: echo BW_CLI_VERSION=$(cat VERSION) >> $GITHUB_ENV
- name: Read version from files
id: version
run: echo VERSION=$(cat VERSION)-$(cat SCRIPTS_VERSION) >> $GITHUB_ENV
- name: Set version for PR
if: github.event_name == 'pull_request' && github.event.action != 'closed' || github.event_name == 'pull_request_target' && github.event.action != 'closed'
run: echo VERSION=${{ env.VERSION }}-${{ github.run_number }}
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.platform }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: ./container
push: true
build-args: |
BW_CLI_VERSION=${{ env.BW_CLI_VERSION }}
tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
env:
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}