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.
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.
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 |
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. |
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 }}
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