mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-05-24 16:19:50 +08:00
* feat: build multi-platform docker image for Dockerfile.stretch * chore: temporary always push branch * ci: update alpine docker build and platform selection * ci: remove buildx for alpine build, configure pr docker tag * ci: create multi-platform alpine * test: temporarily always build multi-arch * fix: multi-arch alpine build needs docker buildx and qemu * ci: add new multiplatform workflow; rename or remove old workflows; remove notify jobs * ci: workflow syntax * ci: no vars allowed here * ci: reference current branch for testing * ci: test docker platforms job * ci: remove temp workflow settings Co-authored-by: CharlieC3 <2747302+CharlieC3@users.noreply.github.com>
126 lines
3.8 KiB
YAML
126 lines
3.8 KiB
YAML
name: Build/Release Additional Docker Platform Images
|
|
|
|
# Only run when:
|
|
# - the workflow is automatically triggered during a release with the relevant tag
|
|
# - the workflow is started from the UI with a tag
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
tag:
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
DOCKERHUB_USERNAME:
|
|
required: true
|
|
DOCKERHUB_PASSWORD:
|
|
required: true
|
|
|
|
env:
|
|
BUILD_PLATFORMS: linux/arm64
|
|
|
|
jobs:
|
|
# Build docker image, tag it with the branch and docker image tag passed in, and publish
|
|
build-publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set Vars
|
|
run: |
|
|
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
|
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: |
|
|
blockstack/${{ github.event.repository.name }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
${{ inputs.tag }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
- name: Build/Tag/Push Image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
platforms: ${{ env.BUILD_PLATFORMS }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
|
|
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
|
|
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
|
|
push: true
|
|
|
|
# Build docker image, tag it with the branch and docker image tag passed in, and publish
|
|
build-publish-stretch:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Determine Stretch Tag and build platforms
|
|
run: |
|
|
if [[ -z ${TAG} ]]; then
|
|
REF=$(echo ${GITHUB_REF#refs/*/} | tr / -)
|
|
if [[ "${REF}" == "master" ]]; then
|
|
echo "STRETCH_TAG=latest-stretch" >> $GITHUB_ENV
|
|
else
|
|
echo "STRETCH_TAG=${REF}-stretch" >> $GITHUB_ENV
|
|
fi
|
|
else
|
|
echo "STRETCH_TAG=${TAG}-stretch" >> $GITHUB_ENV
|
|
fi
|
|
env:
|
|
TAG: ${{ inputs.tag }}
|
|
|
|
- name: Set Vars
|
|
run: |
|
|
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
|
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: |
|
|
blockstack/${{ github.event.repository.name }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
${{ env.STRETCH_TAG }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
- name: Build/Tag/Push Image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
platforms: ${{ env.BUILD_PLATFORMS }}
|
|
file: Dockerfile.stretch
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
|
|
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
|
|
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
|
|
push: true
|