Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Merge pull request #12 from buildsociety/Trozz-patch-1 #698

Merge pull request #12 from buildsociety/Trozz-patch-1

Merge pull request #12 from buildsociety/Trozz-patch-1 #698

Workflow file for this run

name: build
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
push:
branches:
- 'master'
tags:
- '*'
paths-ignore:
- '**.md'
pull_request:
branches:
- 'master'
paths-ignore:
- '**.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Prepare
id: prepare
run: |
DOCKER_USERNAME=$(if [ -z "${{ secrets.DOCKER_USERNAME }}" ]; then echo buildsocietybot; else echo ${{ secrets.DOCKER_USERNAME }}; fi)
DOCKER_IMAGE=${{ github.repository }}
DOCKER_PLATFORMS=linux/amd64,linux/386,linux/ppc64le,linux/arm/v6,linux/arm/v7,linux/arm64/v8
VERSION=$(curl --silent "https://api.github.com/repos/slackhq/nebula/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
TAGS="${DOCKER_IMAGE}:${VERSION}"
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
echo ::set-output name=docker_username::${DOCKER_USERNAME}
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=docker_platforms::${DOCKER_PLATFORMS}
BUILDX_ARGS=$( \
echo VERSION=${VERSION}; \
echo BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ'); \
echo VCS_REF=${GITHUB_SHA::8})
BUILDX_ARGS="${BUILDX_ARGS//$'\n'/'%0A'}"
echo ::set-output name=buildx_args::${BUILDX_ARGS}
echo ::set-output name=tags::${TAGS}
-
name: QEMU
uses: docker/[email protected]
-
name: Set up Docker Buildx
uses: docker/[email protected]
-
name: Checkout
uses: actions/[email protected]
-
name: Docker Buildx (build)
uses: docker/[email protected]
with:
file: Dockerfile
build-args: ${{ steps.prepare.outputs.buildx_args }}
context: .
push: false
platforms: ${{ steps.prepare.outputs.docker_platforms }}
tags: ${{ steps.prepare.outputs.tags }}
-
name: Docker Login
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
uses: docker/[email protected]
with:
username: ${{ steps.prepare.outputs.docker_username }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Docker Buildx (push) - nebula
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
uses: docker/[email protected]
with:
file: Dockerfile
build-args: ${{ steps.prepare.outputs.buildx_args }}
context: .
push: true
platforms: ${{ steps.prepare.outputs.docker_platforms }}
tags: ${{ steps.prepare.outputs.tags }}
-
name: Docker Check Manifest
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
run: |
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}