Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5c140cfb94 | ||
|
6cc07472c0 | ||
|
5ecce77816 | ||
|
741aa98f85 | ||
|
4a3b775794 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -98,7 +98,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: ${{ env.DOCKER_IMAGE }}
|
images: ${{ env.DOCKER_IMAGE }}
|
||||||
tag-sha: true
|
tag-sha: true
|
||||||
tag-match: \\d{1,3}.\\d{1,3}.\\d{1,3}
|
tag-match: '\d{1,3}.\d{1,3}.\d{1,3}'
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.6.0 (2020/10/28)
|
||||||
|
|
||||||
|
* Generate latest tag by default on push tag event (#5)
|
||||||
|
|
||||||
## 1.5.0 (2020/10/27)
|
## 1.5.0 (2020/10/27)
|
||||||
|
|
||||||
* Add `tag-match-group` input to choose group to get if `tag-match` matches
|
* Add `tag-match-group` input to choose group to get if `tag-match` matches
|
||||||
|
46
README.md
46
README.md
@@ -23,8 +23,10 @@ ___
|
|||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [outputs](#outputs)
|
* [outputs](#outputs)
|
||||||
* [Notes](#notes)
|
* [Notes](#notes)
|
||||||
|
* [Latest tag](#latest-tag)
|
||||||
* [`tag-match` examples](#tag-match-examples)
|
* [`tag-match` examples](#tag-match-examples)
|
||||||
* [Schedule tag](#schedule-tag)
|
* [Schedule tag](#schedule-tag)
|
||||||
|
* [Overwrite labels](#overwrite-labels)
|
||||||
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
||||||
* [How can I help?](#how-can-i-help)
|
* [How can I help?](#how-can-i-help)
|
||||||
* [License](#license)
|
* [License](#license)
|
||||||
@@ -41,10 +43,9 @@ ___
|
|||||||
|-----------------|-------------------------------|------------|-------------------------------------|
|
|-----------------|-------------------------------|------------|-------------------------------------|
|
||||||
| `schedule` | `refs/heads/master` | `45f132a` | `sha-45f132a`, `nightly` |
|
| `schedule` | `refs/heads/master` | `45f132a` | `sha-45f132a`, `nightly` |
|
||||||
| `pull_request` | `refs/pull/2/merge` | `a123b57` | `sha-a123b57`, `pr-2` |
|
| `pull_request` | `refs/pull/2/merge` | `a123b57` | `sha-a123b57`, `pr-2` |
|
||||||
| `push` | `refs/heads/<default_branch>` | `676cae2` | `sha-676cae2`, `edge` |
|
| `push` | `refs/heads/master` | `cf20257` | `sha-cf20257`, `master` |
|
||||||
| `push` | `refs/heads/dev` | `cf20257` | `sha-cf20257`, `dev` |
|
|
||||||
| `push` | `refs/heads/my/branch` | `a5df687` | `sha-a5df687`, `my-branch` |
|
| `push` | `refs/heads/my/branch` | `a5df687` | `sha-a5df687`, `my-branch` |
|
||||||
| `push tag` | `refs/tags/v1.2.3` | `bf4565b` | `sha-bf4565b`, `1.2.3`, `latest` |
|
| `push tag` | `refs/tags/v1.2.3` | `bf4565b` | `sha-bf4565b`, `v1.2.3`, `latest` |
|
||||||
| `push tag` | `refs/tags/mytag` | `afb7833` | `sha-afb7833`, `mytag` |
|
| `push tag` | `refs/tags/mytag` | `afb7833` | `sha-afb7833`, `mytag` |
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -75,9 +76,6 @@ jobs:
|
|||||||
uses: crazy-max/ghaction-docker-meta@v1
|
uses: crazy-max/ghaction-docker-meta@v1
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
tag-sha: true
|
|
||||||
tag-match: v(.*)
|
|
||||||
tag-match-group: 1
|
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
@@ -136,15 +134,21 @@ Following outputs are available
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
### Latest tag
|
||||||
|
|
||||||
|
Latest Docker tag will be generated by default on `push tag` event. So if for example you push the `v1.2.3` Git tag,
|
||||||
|
you will have at the output of this action the Docker tags `v1.2.3` and `latest`. But you can allow the latest tag to be
|
||||||
|
generated only if the Git tag matches a regular expression with the [`tag-match` input](#tag-match-examples).
|
||||||
|
|
||||||
### `tag-match` examples
|
### `tag-match` examples
|
||||||
|
|
||||||
| Git tag | `tag-match` | `tag-match-group` | Docker tag
|
| Git tag | `tag-match` | `tag-match-group` | Docker tag
|
||||||
|-------------------------|------------------------------------|-------------------|------------------|
|
|-------------------------|------------------------------------|-------------------|------------------|
|
||||||
| `v1.2.3` | `\\d{1,3}.\\d{1,3}.\\d{1,3}` | `0` | `1.2.3` |
|
| `v1.2.3` | `\d{1,3}.\d{1,3}.\d{1,3}` | `0` | `1.2.3` |
|
||||||
| `v2.0.8-beta.67` | `v(.*)` | `1` | `2.0.8-beta.67` |
|
| `v2.0.8-beta.67` | `v(.*)` | `1` | `2.0.8-beta.67` |
|
||||||
| `v2.0.8-beta.67` | `v(\\d.\\d)` | `1` | `2.0` |
|
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | `2.0` |
|
||||||
| `release1` | `\\d{1,3}.\\d{1,3}` | `0` | `release1` |
|
| `release1` | `\d{1,3}.\d{1,3}` | `0` | `release1` |
|
||||||
| `20200110-RC2` | `\\d+` | `0` | `20200110` |
|
| `20200110-RC2` | `\d+` | `0` | `20200110` |
|
||||||
|
|
||||||
### Schedule tag
|
### Schedule tag
|
||||||
|
|
||||||
@@ -157,6 +161,28 @@ the following expressions:
|
|||||||
|
|
||||||
You can find more examples in the [CI workflow](.github/workflows/ci.yml).
|
You can find more examples in the [CI workflow](.github/workflows/ci.yml).
|
||||||
|
|
||||||
|
### Overwrite labels
|
||||||
|
|
||||||
|
If some of the [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)
|
||||||
|
labels generated are not suitable, you can overwrite them like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/386
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||||
|
labels: |
|
||||||
|
${{ steps.docker_meta.outputs.labels }}
|
||||||
|
org.opencontainers.image.title=MyCustomTitle
|
||||||
|
org.opencontainers.image.description=Another description
|
||||||
|
org.opencontainers.image.vendor=MyCompany
|
||||||
|
```
|
||||||
|
|
||||||
## Keep up-to-date with GitHub Dependabot
|
## Keep up-to-date with GitHub Dependabot
|
||||||
|
|
||||||
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
|
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
|
||||||
|
@@ -377,10 +377,11 @@ describe('push tag', () => {
|
|||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
version: 'release1',
|
version: 'release1',
|
||||||
latest: false
|
latest: true
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'user/app:release1'
|
'user/app:release1',
|
||||||
|
'user/app:latest'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"org.opencontainers.image.title=Hello-World",
|
"org.opencontainers.image.title=Hello-World",
|
||||||
@@ -400,10 +401,11 @@ describe('push tag', () => {
|
|||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
version: '20200110-RC2',
|
version: '20200110-RC2',
|
||||||
latest: false
|
latest: true
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'user/app:20200110-RC2'
|
'user/app:20200110-RC2',
|
||||||
|
'user/app:latest'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"org.opencontainers.image.title=Hello-World",
|
"org.opencontainers.image.title=Hello-World",
|
||||||
@@ -686,11 +688,13 @@ describe('latest', () => {
|
|||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
version: 'v1.1.1',
|
version: 'v1.1.1',
|
||||||
latest: false
|
latest: true
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'org/app:v1.1.1',
|
'org/app:v1.1.1',
|
||||||
|
'org/app:latest',
|
||||||
'ghcr.io/user/app:v1.1.1',
|
'ghcr.io/user/app:v1.1.1',
|
||||||
|
'ghcr.io/user/app:latest',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"org.opencontainers.image.title=Hello-World",
|
"org.opencontainers.image.title=Hello-World",
|
||||||
@@ -951,10 +955,11 @@ describe('release', () => {
|
|||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
version: 'v1.1.1',
|
version: 'v1.1.1',
|
||||||
latest: false
|
latest: true
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'user/app:v1.1.1',
|
'user/app:v1.1.1',
|
||||||
|
'user/app:latest',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"org.opencontainers.image.title=Hello-World",
|
"org.opencontainers.image.title=Hello-World",
|
||||||
|
3
dist/index.js
generated
vendored
3
dist/index.js
generated
vendored
@@ -208,6 +208,9 @@ class Meta {
|
|||||||
version.latest = this.inputs.tagMatchLatest;
|
version.latest = this.inputs.tagMatchLatest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
version.latest = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (/^refs\/heads\//.test(this.context.ref)) {
|
else if (/^refs\/heads\//.test(this.context.ref)) {
|
||||||
version.version = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
version.version = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
||||||
|
@@ -52,6 +52,8 @@ export class Meta {
|
|||||||
version.version = tagMatch[this.inputs.tagMatchGroup];
|
version.version = tagMatch[this.inputs.tagMatchGroup];
|
||||||
version.latest = this.inputs.tagMatchLatest;
|
version.latest = this.inputs.tagMatchLatest;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
version.latest = true;
|
||||||
}
|
}
|
||||||
} else if (/^refs\/heads\//.test(this.context.ref)) {
|
} else if (/^refs\/heads\//.test(this.context.ref)) {
|
||||||
version.version = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
version.version = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
||||||
|
Reference in New Issue
Block a user