mirror of
https://github.com/peter-evans/dockerhub-description.git
synced 2024-11-25 13:39:33 +01:00
Merge pull request #4 from peter-evans/container-action-update
Update for Actions v2
This commit is contained in:
commit
7567c7b51b
3 changed files with 10 additions and 71 deletions
|
@ -1,70 +0,0 @@
|
|||
version: 2.1
|
||||
executors:
|
||||
docker-executor:
|
||||
environment:
|
||||
IMAGE_NAME: peterevans/dockerhub-description
|
||||
docker:
|
||||
- image: circleci/buildpack-deps:stretch
|
||||
jobs:
|
||||
build:
|
||||
executor: docker-executor
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker:
|
||||
docker_layer_caching: true
|
||||
- run:
|
||||
name: Build Docker image
|
||||
command: |
|
||||
docker build -t $IMAGE_NAME:latest . --label "org.opencontainers.image.version=${CIRCLE_TAG/v/''}"
|
||||
- run:
|
||||
name: Cache Docker image
|
||||
command: docker save -o image.tar $IMAGE_NAME
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- ./image.tar
|
||||
publish-tag:
|
||||
executor: docker-executor
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: /tmp/workspace
|
||||
- setup_remote_docker
|
||||
- run:
|
||||
name: Load cached Docker image
|
||||
command: docker load -i /tmp/workspace/image.tar
|
||||
- run:
|
||||
name: Publish Docker Image to Docker Hub
|
||||
command: |
|
||||
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
|
||||
IMAGE_TAG=${CIRCLE_TAG/v/''}
|
||||
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$IMAGE_TAG
|
||||
docker push $IMAGE_NAME:latest
|
||||
docker push $IMAGE_NAME:$IMAGE_TAG
|
||||
# If the minor version can be extracted then tag and push
|
||||
MINOR_VERSION=$(echo $CIRCLE_TAG | sed -n "s/^v\([0-9]*.[0-9]*\).[0-9]*$/\1/p")
|
||||
if [[ ${#MINOR_VERSION} -gt 0 ]]; then
|
||||
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$MINOR_VERSION
|
||||
docker push $IMAGE_NAME:$MINOR_VERSION
|
||||
fi
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- build
|
||||
build-and-publish-tags:
|
||||
jobs:
|
||||
- build:
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
- publish-tag:
|
||||
context: org-global
|
||||
requires:
|
||||
- build
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
2
.github/workflows/push.yml
vendored
2
.github/workflows/push.yml
vendored
|
@ -7,7 +7,7 @@ jobs:
|
|||
dockerHubDescription:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/checkout@v1
|
||||
- name: Docker Hub Description
|
||||
uses: ./
|
||||
env:
|
||||
|
|
9
action.yml
Normal file
9
action.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
name: 'Docker Hub Description'
|
||||
author: 'Peter Evans'
|
||||
description: 'An action to update a Docker Hub repository description from README.md'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'docker://peterevans/dockerhub-description:2.1.0'
|
||||
branding:
|
||||
icon: 'upload'
|
||||
color: 'blue'
|
Loading…
Reference in a new issue