GitHub Action
Docker Tags by SemVer
v1.0.5
Latest version
DEPRECATED: It is recommended to use docker/build-push-action with docker/metadata-action
This action create multiple docker tags by specified Semantic Version with docker tag
command.
However, this action does NOT execute both docker login
and docker build
. Do it yourself if needed.
steps:
- uses: weseek/ghaction-docker-tags-by-semver@v1
with:
source: 'myimage'
target: myorg/myimage
semver: '1.2.3'
exec following command:
docker tag myimage myorg/myimage:1.2.3
docker tag myimage myorg/myimage:1.2
docker tag myimage myorg/myimage:1
parameter | required | default value | description |
---|---|---|---|
source | ✔️ | ID or name of the source docker image docker docs |
|
target | ✔️ | Name of the target docker image without tag docker docs |
|
semver | ✔️ | Semantic Version to create docker tags | |
suffix | Suffix string to add to tag | ||
additional-tags | Comma-separated string of tags to append | ||
publish | Publish images or not |
steps:
- name: Login to docker.io registry
run: |
echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} | docker login --username ${{ secrets. DOCKER_REGISTRY_USERNAME }} --password-stdin
- name: Build image
run: |
docker build -t myimage .
- uses: weseek/ghaction-docker-tags-by-semver@v1
with:
source: 'myimage'
target: myorg/myimage
semver: '1.2.3'
publish: true
exec following command:
echo ... | docker login --username ... --password-stdin
docker build -t myimage .
docker tag myimage myorg/myimage:1.2.3
docker push myorg/myimage:1.2.3
docker tag myimage myorg/myimage:1.2
docker push myorg/myimage:1.2
docker tag myimage myorg/myimage:1
docker push myorg/myimage:1
steps:
- uses: weseek/ghaction-docker-tags-by-semver@v1
with:
source: 'myimage'
target: myorg/myimage
semver: '1.2.3'
suffix: '-nocdn'
exec following command:
docker tag myimage myorg/myimage:1.2.3-nocdn
docker tag myimage myorg/myimage:1.2-nocdn
docker tag myimage myorg/myimage:1-nocdn
steps:
- uses: weseek/ghaction-docker-tags-by-semver@v1
with:
source: 'myimage'
target: myorg/myimage
semver: '1.2.3'
suffix: '-nocdn'
additional-tags: 'latest,lts'
exec following command:
docker tag myimage myorg/myimage:1.2.3-nocdn
docker tag myimage myorg/myimage:1.2-nocdn
docker tag myimage myorg/myimage:1-nocdn
docker tag myimage myorg/myimage:latest-nocdn
docker tag myimage myorg/myimage:lts-nocdn
If semver
ends with -RC
, tag with timestamp is created automatically.
steps:
- uses: weseek/ghaction-docker-tags-by-semver@v1
with:
source: 'myimage'
target: myorg/myimage
semver: '1.2.4-RC'
exec following command:
docker tag myimage myorg/myimage:1.2.4-RC
docker tag myimage myorg/myimage:1.2.4-RC.20200703090000
The scripts and documentation in this project are released under the MIT License