Docker - feishu #2
Workflow file for this run
This file contains 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 - feishu | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
on-success: | |
needs: publish | |
runs-on: ubuntu-latest | |
if: ${{ always() && needs.publish.result == 'success' }} | |
steps: | |
- name: Notification Feishu | |
uses: whatwewant/[email protected] | |
with: | |
url: ${{ secrets.DOCKER_VERSION_FEISHU_BOT_WEBHOOK_URL }} | |
title: '✅ Docker 发布:${{ github.repository }}' | |
text: | | |
分支: ${{ github.ref }} | |
提交信息: ${{ github.event.head_commit.message }} | |
提交人: ${{ github.actor }} | |
状态: 构建成功(https://github.com/${{ github.repository }}/actions/runs/${{ github.run.id }}) | |
on-failure: | |
needs: publish | |
runs-on: ubuntu-latest | |
if: ${{ always() && needs.publish.result == 'failure' }} | |
steps: | |
- name: Notification Feishu | |
uses: whatwewant/[email protected] | |
with: | |
url: ${{ secrets.DOCKER_VERSION_FEISHU_BOT_WEBHOOK_URL }} | |
title: '❌ Docker 发布:${{ github.repository }}' | |
text: | | |
分支: ${{ github.ref }} | |
提交信息: ${{ github.event.head_commit.message }} | |
提交人: ${{ github.actor }} | |
状态: 构建失败(https://github.com/${{ github.repository }}/actions/runs/${{ github.run.id }}) | |
publish: | |
runs-on: ubuntu-latest | |
container: whatwewant/zmicro:v1 | |
steps: | |
- name: Update zmicro to latest | |
run: zmicro update | |
- name: Get Current Date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: '0' | |
- name: Docker Meta | |
id: meta | |
run: | | |
IMAGE_VERSION=$(echo ${GITHUB_REF} | sed -e "s%refs/tags/%%g") | |
IMAGE_NAME=${ACTION_IMAGE_NAMESPACE}/${ACTION_IMAGE_NAME} | |
IMAGE_TAGS=$(zmicro fn tag::docker $IMAGE_NAME $IMAGE_VERSION) | |
echo "::set-output name=version::${IMAGE_VERSION}" | |
echo "::set-output name=name::${IMAGE_NAME}" | |
echo "::set-output name=tags::${IMAGE_TAGS}" | |
shell: bash | |
env: | |
ACTION_IMAGE_NAMESPACE: ${{ secrets.DOCKERHUB_USERNAME }} | |
ACTION_IMAGE_NAME: connect-feishu | |
- name: Show Docker Tags | |
run: | | |
echo "Docker Tags: ${{ steps.meta.outputs.tags }}" | |
- name: Build and push | |
uses: zmicro-design/action-docker-build@v1 | |
with: | |
build-args: | | |
VERSION=${{ steps.meta.outputs.version }} | |
BUILD_TIME=${{ steps.meta.outputs.build_time }} | |
COMMIT_HASH=${{ steps.meta.outputs.commit_hash }} | |
context: . | |
dockerfile: Dockerfile.feishu | |
push: ${{ github.event_name != 'pull_request' }} | |
cache-from: type=registry,ref=${{ steps.meta.outputs.name }}:buildcache | |
cache-to: type=registry,ref=${{ steps.meta.outputs.name }}:buildcache,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} |