Skip to content

Update README.md

Update README.md #17

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Publish Github Image
on:
push:
branches:
- "develop"
tags:
- 'v*'
pull_request:
branches: [ "develop" ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ''
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
push_to_registry:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Use Node
uses: actions/setup-node@v1
with:
node-version: 14
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{env.IMAGE_NAME}}
- name: echo
run: echo $GITHUB_REF_NAME
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
flavor: |
latest=auto
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
# tag event
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
# 推送
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Build and Push
# uses: docker/build-push-action@v4
# with:
# context: .
# push: true
# labels: ${{ steps.metadata.outputs.labels }}
# tags: |
# ${{ steps.metadata.outputs.tags }}
# platforms: linux/amd64,linux/arm64,linux/arm/v7
# build-args: |
# REPLACE_CHINA_MIRROR=false
# VCS_REF=${{ github.sha }}
# BUILD_DATE=${{ fromJSON(steps.metadata.outputs.json).labels['org.opencontainers.image.created'] }}
# - name: Create Release
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# env:
# GITHUB_TOKEN: ${{ secrets.CR_PAT }}