Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66277dfaec | ||
|
|
5a618d1434 | ||
|
|
ba4f12bfe1 | ||
|
|
7f8bdc5174 | ||
|
|
2cdc04310b | ||
|
|
766da51375 | ||
|
|
49d8359332 | ||
|
|
b2856ab64f | ||
|
|
ef7baa2fee | ||
|
|
5f19c66987 | ||
|
|
9e8150a63d | ||
|
|
ff4c066a7a | ||
|
|
0f1898c5f3 |
70
.circleci/config.yml
Normal file
70
.circleci/config.yml
Normal file
@@ -0,0 +1,70 @@
|
||||
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: /.*/
|
||||
15
.github/main.workflow
vendored
Normal file
15
.github/main.workflow
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
workflow "Update Docker Hub Description" {
|
||||
resolves = ["Docker Hub Description"]
|
||||
on = "push"
|
||||
}
|
||||
|
||||
action "Filter master branch" {
|
||||
uses = "actions/bin/filter@master"
|
||||
args = "branch master"
|
||||
}
|
||||
|
||||
action "Docker Hub Description" {
|
||||
needs = ["Filter master branch"]
|
||||
uses = "./"
|
||||
secrets = ["DOCKERHUB_USERNAME", "DOCKERHUB_PASSWORD", "DOCKERHUB_REPOSITORY"]
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM peterevans/curl-jq:1.0.0
|
||||
FROM peterevans/curl-jq:1.0.1
|
||||
|
||||
LABEL maintainer="Peter Evans <mail@peterevans.dev>"
|
||||
LABEL repository="https://github.com/peter-evans/dockerhub-description"
|
||||
@@ -9,7 +9,7 @@ LABEL com.github.actions.description="An action to update a Docker Hub repositor
|
||||
LABEL com.github.actions.icon="upload"
|
||||
LABEL com.github.actions.color="blue"
|
||||
|
||||
COPY LICENSE README.md
|
||||
COPY LICENSE README.md /
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
|
||||
29
README.md
29
README.md
@@ -1,4 +1,5 @@
|
||||
# Docker Hub Description
|
||||
[](https://github.com/marketplace/actions/docker-hub-description)
|
||||
|
||||
A GitHub action to update a Docker Hub repository description from `README.md`.
|
||||
|
||||
@@ -7,8 +8,8 @@ This is useful if you `docker push` your images to Docker Hub. It provides an ea
|
||||
## Usage
|
||||
|
||||
```
|
||||
action "Update Docker Hub Repository Description" {
|
||||
uses = "peter-evans/dockerhub-description@master"
|
||||
action "Docker Hub Description" {
|
||||
uses = "peter-evans/dockerhub-description@v1.0.0"
|
||||
secrets = ["DOCKERHUB_USERNAME", "DOCKERHUB_PASSWORD", "DOCKERHUB_REPOSITORY"]
|
||||
}
|
||||
```
|
||||
@@ -17,7 +18,9 @@ action "Update Docker Hub Repository Description" {
|
||||
|
||||
- `DOCKERHUB_USERNAME` - Docker Hub username
|
||||
- `DOCKERHUB_PASSWORD` - Docker Hub password
|
||||
- `DOCKERHUB_REPOSITORY` - The name of the Docker Hub repository to update. (This may also be an environment variable if not considered sensitive)
|
||||
- `DOCKERHUB_REPOSITORY` - The name of the Docker Hub repository to update. The action combines this with the username to locate the repository. i.e. `username/repository`
|
||||
|
||||
Note that `DOCKERHUB_USERNAME` and `DOCKERHUB_REPOSITORY` may also be environment variables if not considered sensitive.
|
||||
|
||||
#### Optionally specifying the file path
|
||||
|
||||
@@ -25,8 +28,8 @@ The action assumes that there is a file called `README.md` located at the root o
|
||||
If this is not the case, the path can be overridden with an environment variable.
|
||||
|
||||
```
|
||||
action "Update Docker Hub Repository Description" {
|
||||
uses = "peter-evans/dockerhub-description@master"
|
||||
action "Docker Hub Description" {
|
||||
uses = "peter-evans/dockerhub-description@v1.0.0"
|
||||
secrets = ["DOCKERHUB_USERNAME", "DOCKERHUB_PASSWORD", "DOCKERHUB_REPOSITORY"]
|
||||
env = {
|
||||
README_FILEPATH = "./some-path/README.md"
|
||||
@@ -38,9 +41,9 @@ action "Update Docker Hub Repository Description" {
|
||||
|
||||
Updates the Docker Hub repository description whenever there is a `git push` to the `master` branch.
|
||||
```
|
||||
workflow "New workflow" {
|
||||
workflow "Update Docker Hub Description" {
|
||||
resolves = ["Docker Hub Description"]
|
||||
on = "push"
|
||||
resolves = ["Update Docker Hub Repository Description"]
|
||||
}
|
||||
|
||||
action "Filter master branch" {
|
||||
@@ -48,22 +51,22 @@ action "Filter master branch" {
|
||||
args = "branch master"
|
||||
}
|
||||
|
||||
action "Update Docker Hub Repository Description" {
|
||||
action "Docker Hub Description" {
|
||||
needs = ["Filter master branch"]
|
||||
uses = "peter-evans/dockerhub-description@master"
|
||||
uses = "peter-evans/dockerhub-description@v1.0.0"
|
||||
secrets = ["DOCKERHUB_USERNAME", "DOCKERHUB_PASSWORD", "DOCKERHUB_REPOSITORY"]
|
||||
}
|
||||
```
|
||||
|
||||
Updates the Docker Hub repository description whenever a new release is created.
|
||||
```
|
||||
workflow "New workflow" {
|
||||
workflow "Update Docker Hub Description" {
|
||||
resolves = ["Docker Hub Description"]
|
||||
on = "release"
|
||||
resolves = ["Update Docker Hub Repository Description"]
|
||||
}
|
||||
|
||||
action "Update Docker Hub Repository Description" {
|
||||
uses = "peter-evans/dockerhub-description@master"
|
||||
action "Docker Hub Description" {
|
||||
uses = "peter-evans/dockerhub-description@v1.0.0"
|
||||
secrets = ["DOCKERHUB_USERNAME", "DOCKERHUB_PASSWORD", "DOCKERHUB_REPOSITORY"]
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user