Docker Tag latest-release #372
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 Tag latest-release | |
# Run every couple of days | |
on: | |
schedule: | |
- cron: "30 12 */2 * *" | |
jobs: | |
# This pulls all containers for the last known release tag, and tags as latest-release or x-latest-release for shared repo | |
tagLatestRelease: | |
runs-on: ubuntu-latest | |
steps: | |
# Pull the code so we have git metadata | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# This action will "unshallow" so we have all tag info | |
- name: Get latest tag | |
id: tagger | |
uses: jimschubert/query-tag-action@v2 | |
with: | |
include: 'v*' | |
exclude: '*-rc*' | |
commit-ish: 'HEAD~' | |
- name: DockerHub Login | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
# Tags openapitools/openapi-generator-cli | |
- name: "Tag openapi-generator-cli:x" | |
id: tag-openapi-generator-cli | |
if: always() | |
run: | | |
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}' | |
docker pull openapitools/openapi-generator-cli:${{steps.tagger.outputs.tag}} | |
docker tag openapitools/openapi-generator-cli:${{steps.tagger.outputs.tag}} openapitools/openapi-generator-cli:latest-release | |
docker push openapitools/openapi-generator-cli:latest-release | |
# Tags openapitools/openapi-generator-online | |
- name: "Tag openapi-generator-online:x" | |
id: tag-openapi-generator-online | |
if: always() | |
run: | | |
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}' | |
docker pull openapitools/openapi-generator-online:${{steps.tagger.outputs.tag}} | |
docker tag openapitools/openapi-generator-online:${{steps.tagger.outputs.tag}} openapitools/openapi-generator-online:latest-release | |
docker push openapitools/openapi-generator-online:latest-release | |
# Tags openapitools/openapi-generator's CLI image (this repo holds CLI + Online via tag prefix) | |
- name: "Tag openapi-generator:cli-x" | |
id: tag-cli | |
if: always() | |
run: | | |
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}' | |
docker pull openapitools/openapi-generator:cli-${{steps.tagger.outputs.tag}} | |
docker tag openapitools/openapi-generator:cli-${{steps.tagger.outputs.tag}} openapitools/openapi-generator:cli-latest-release | |
docker push openapitools/openapi-generator:cli-latest-release | |
# Tags openapitools/openapi-generator's ONLINE image (this repo holds CLI + Online via tag prefix) | |
- name: "Tag openapi-generator:online-x" | |
id: tag-online | |
if: always() | |
run: | | |
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}' | |
docker pull openapitools/openapi-generator:online-${{steps.tagger.outputs.tag}} | |
docker tag openapitools/openapi-generator:online-${{steps.tagger.outputs.tag}} openapitools/openapi-generator:online-latest-release | |
docker push openapitools/openapi-generator:online-latest-release | |
# Clean up docker credentials/configs/etc. | |
- name: Cleanup | |
if: always() | |
run: | | |
rm -f ${HOME}/.docker/config.json |