Skip to content

add action to build image #1

add action to build image

add action to build image #1

Workflow file for this run

name: build-image
on:
push:
branches:
- "main"
tags:
- "v*"
paths:
- "**.*"
jobs:
build:
name: build-image
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Extract Tag
id: extract_tag
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Docker login
env:
DOCKER_USERNAME: ${{ secrets.ALIYUN_REGISTRY_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin registry.cn-shanghai.aliyuncs.com
- name: Run buildx
run: |
tag=latest
echo extract_tag ${{ steps.extract_tag.outputs.version }}
echo extract_branch ${{ steps.extract_branch.outputs.branch }}
echo current tag is ${tag}
docker buildx build --platform linux/amd64,linux/arm64 --push -t registry.cn-shanghai.aliyuncs.com/openhydra/open-hydra-ui:${tag} .