Skip to content

wooseopkim/unpublished-tags

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unpublished Tags Action

Summary

This is a GitHub Actions action to fetch tags or commits that are in the GitHub repository but not published on the Docker Hub repository yet, along with the ones that are already published.

User Guide

Before you use this action, you'll need to call actions/checkout with the repository of interest. Note that you need to provide input fetch-depth: 0 to the checkout action.

Inputs

NAME REQUIRED EXAMPLE
ref-type false (default: tag) head
dockerhub-repository true org/repository
first-ref false (default: <first tag or commit>) v1.2.3
checkout-path false (default: .) dir

Outputs

NAME EXAMPLE NOTE
unpublished ["<latest git commit>", ..., "<oldest git commit>"] This is the list of git refs, not Docker tags.
published ["v0.1.0", ..., "v1.2.3"] This is the list of git refs, not Docker tags.

Example

jobs:
  tags:
    runs-on: ubuntu-latest
    outputs:
      json: ${{ steps.unpublished.outputs.unpublished }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Get unpublished tags
        id: unpublished
        uses: wooseopkim/unpublished-tags@v3
        with:
          dockerhub-repository: org/repository
  build:
    needs: [tags]
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 1
      matrix:
        tag: ${{ fromJSON(needs.tags.outputs.unpublished) }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Build
        run: ./build.sh --tag=${{ matrix.tag }}

Limitations and caution

This action is made for personal use and functions are limited. For example, you can only fetch published tags from Docker Hub, not from other registries such as GitHub Container Registry. PRs are welcome though.

You can only get the tags that actually belong to branches on GitHub. The tags which does not belong to a branch will be discarded. Thus the output might not include tags you can see on GitHub or in the git tag -l result. Use git tag --merged <ref> instead.

This action assumes that:

  • The Docker Hub tag names are the same as git tags or commit hashes,
  • If a tag is published, all previous tags are already published

About

Fetch tags that are present in git repo but not published on Docker Hub repo

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages