Docker Build Release #1
This file contains hidden or 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 Build Release | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 1 * * *" | |
jobs: | |
extract-version: | |
name: Extract version | |
runs-on: warp-ubuntu-latest-x64-16x | |
outputs: | |
VERSION: ${{ steps.extract_version.outputs.VERSION }} | |
steps: | |
- name: Extract version | |
id: extract_version | |
run: | | |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then | |
VERSION="${GITHUB_REF#refs/tags/}" | |
else | |
VERSION="$(echo ${GITHUB_SHA} | cut -c1-7)" | |
fi | |
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
echo "| | |" >> $GITHUB_STEP_SUMMARY | |
echo "| ------------------- | ---------------------- |" >> $GITHUB_STEP_SUMMARY | |
echo "| \`GITHUB_REF_TYPE\` | \`${GITHUB_REF_TYPE}\` |" >> $GITHUB_STEP_SUMMARY | |
echo "| \`GITHUB_REF_NAME\` | \`${GITHUB_REF_NAME}\` |" >> $GITHUB_STEP_SUMMARY | |
echo "| \`GITHUB_REF\` | \`${GITHUB_REF}\` |" >> $GITHUB_STEP_SUMMARY | |
echo "| \`GITHUB_SHA\` | \`${GITHUB_SHA}\` |" >> $GITHUB_STEP_SUMMARY | |
echo "| \`VERSION\` | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY | |
build-docker: | |
name: Build and publish Docker image | |
needs: extract-version | |
runs-on: ${{ matrix.configs.runner }} | |
env: | |
VERSION: ${{ needs.extract-version.outputs.VERSION }} | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
configs: | |
- target: linux/amd64 | |
runner: warp-ubuntu-latest-x64-16x | |
- target: linux/arm64 | |
runner: warp-ubuntu-latest-arm64-16x | |
steps: | |
- name: checkout sources | |
uses: actions/checkout@v4 | |
- name: docker qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: docker metadata | |
uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: ghcr.io/${{ github.repository }} | |
labels: org.opencontainers.image.source=${{ github.repositoryUrl }} | |
tags: | | |
type=sha | |
type=schedule,pattern=nightly | |
- name: docker login | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: docker build and push op-rbuilder | |
uses: docker/build-push-action@v5 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
file: Dockerfile | |
context: . | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ matrix.configs.target }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
build-args: | | |
RBUILDER_BIN=op-rbuilder |