Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dd2e615c98 | ||
|
f552880d7c | ||
|
8d7fa04f07 | ||
|
52c4b1ad0c | ||
|
b4c9b2116e | ||
|
5c140cfb94 | ||
|
6cc07472c0 | ||
|
5ecce77816 | ||
|
741aa98f85 | ||
|
4a3b775794 | ||
|
6fe5b3f6bb | ||
|
ad83daa929 | ||
|
a207508e20 | ||
|
983124bca8 |
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@@ -53,15 +53,18 @@ jobs:
|
||||
tag-sha: true
|
||||
tag-schedule: ${{ matrix.tag-schedule }}
|
||||
|
||||
coerce:
|
||||
tag-match:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
tag-coerce-tag:
|
||||
- "{{raw}}"
|
||||
- "{{major}}.{{minor}}"
|
||||
- "{{patch}}"
|
||||
include:
|
||||
- tag-match: '\d{1,3}.\d{1,3}.\d{1,3}'
|
||||
tag-match-group: '0'
|
||||
- tag-match: '\d{1,3}.\d{1,3}'
|
||||
tag-match-group: '0'
|
||||
- tag-match: 'v(.*)'
|
||||
tag-match-group: '1'
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
@@ -73,8 +76,9 @@ jobs:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
tag-coerce-tag: ${{ matrix.tag-coerce-tag }}
|
||||
tag-sha: true
|
||||
tag-match: ${{ matrix.tag-match }}
|
||||
tag-match-group: ${{ matrix.tag-match-group }}
|
||||
|
||||
docker-push:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -92,9 +96,9 @@ jobs:
|
||||
id: docker_meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
images: ${{ env.DOCKER_IMAGE }}
|
||||
tag-sha: true
|
||||
tag-match: '\d{1,3}.\d{1,3}.\d{1,3}'
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,5 +1,23 @@
|
||||
# Changelog
|
||||
|
||||
## 1.7.0 (2020/10/31)
|
||||
|
||||
* Use `repo.html_url` for `org.opencontainers.image.source` label to be able to display README on GHCR
|
||||
* Handle `tag-match-latest` on Git tag event (#8)
|
||||
|
||||
## 1.6.0 (2020/10/28)
|
||||
|
||||
* Generate latest tag by default on push tag event (#5)
|
||||
|
||||
## 1.5.0 (2020/10/27)
|
||||
|
||||
* Add `tag-match-group` input to choose group to get if `tag-match` matches
|
||||
* Check `tag-match` is a valid regex
|
||||
|
||||
## 1.4.0 (2020/10/27)
|
||||
|
||||
* Use RegExp to match against a Git tag instead of coerce
|
||||
|
||||
## 1.3.0 (2020/10/26)
|
||||
|
||||
* Set latest tag only if matches with a pattern
|
||||
|
70
README.md
70
README.md
@@ -24,8 +24,9 @@ ___
|
||||
* [outputs](#outputs)
|
||||
* [Notes](#notes)
|
||||
* [Latest tag](#latest-tag)
|
||||
* [Coerces Git tag](#coerces-git-tag)
|
||||
* [`tag-match` examples](#tag-match-examples)
|
||||
* [Schedule tag](#schedule-tag)
|
||||
* [Overwrite labels](#overwrite-labels)
|
||||
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
||||
* [How can I help?](#how-can-i-help)
|
||||
* [License](#license)
|
||||
@@ -42,11 +43,9 @@ ___
|
||||
|-----------------|-------------------------------|------------|-------------------------------------|
|
||||
| `schedule` | `refs/heads/master` | `45f132a` | `sha-45f132a`, `nightly` |
|
||||
| `pull_request` | `refs/pull/2/merge` | `a123b57` | `sha-a123b57`, `pr-2` |
|
||||
| `push` | `refs/heads/<default_branch>` | `676cae2` | `sha-676cae2`, `edge` |
|
||||
| `push` | `refs/heads/dev` | `cf20257` | `sha-cf20257`, `dev` |
|
||||
| `push` | `refs/heads/master` | `cf20257` | `sha-cf20257`, `master` |
|
||||
| `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/mytag` | `afb7833` | `sha-afb7833`, `mytag` |
|
||||
| `push tag` | `refs/tags/v1.2.3` | `bf4565b` | `sha-bf4565b`, `v1.2.3`, `latest` |
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -75,10 +74,7 @@ jobs:
|
||||
id: docker_meta
|
||||
uses: crazy-max/ghaction-docker-meta@v1
|
||||
with:
|
||||
images: |
|
||||
name/app
|
||||
ghcr.io/name/app
|
||||
tag-sha: true
|
||||
images: name/app
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
@@ -116,8 +112,9 @@ Following inputs can be used as `step.with` keys
|
||||
| `tag-sha` | Bool | Add git short SHA as Docker tag (default `false`) |
|
||||
| `tag-edge` | Bool | Enable edge branch tagging (default `false`) |
|
||||
| `tag-edge-branch` | String | Branch that will be tagged as edge (default `repo.default_branch`) |
|
||||
| `tag-coerce-tag` | String | Coerces Git tag to semver if possible using [template](#coerces-git-tag) |
|
||||
| `tag-latest-match` | String | Set `latest` tag only if [matches with a pattern](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) |
|
||||
| `tag-match` | String | RegExp to match against a Git tag and use first match as Docker tag |
|
||||
| `tag-match-group` | Number | Group to get if `tag-match` matches (default `0`) |
|
||||
| `tag-match-latest` | Bool | Set `latest` Docker tag if `tag-match` matches or on Git tag event (default `true`) |
|
||||
| `tag-schedule` | String | [Template](#schedule-tag) to apply to schedule tag (default `nightly`) |
|
||||
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
|
||||
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
|
||||
@@ -138,26 +135,19 @@ Following outputs are available
|
||||
|
||||
### Latest tag
|
||||
|
||||
`latest` tag is created with the following conditions:
|
||||
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).
|
||||
|
||||
* Git tag is a valid [semver](https://semver.org/)
|
||||
* Provided `tag-coerce-tag` is valid
|
||||
### `tag-match` examples
|
||||
|
||||
If `tag-latest-match` is filled, then it has priority over the creation of the tag.
|
||||
|
||||
### Coerces Git tag
|
||||
|
||||
Provides a very forgiving translation of a non-semver tag to semver. For more information see
|
||||
[Coercion section](https://www.npmjs.com/package/semver#coercion). `tag-coerce-tag` supports
|
||||
[Handlebars template](https://handlebarsjs.com/guide/) with the following inputs:
|
||||
|
||||
| `tag-coerce-tag` | Git tag | Version |
|
||||
|-------------------------|----------|---------|
|
||||
| `{{raw}}` | `v1.2.3` | `1.2.3` |
|
||||
| `{{major}}.{{minor}}` | `v1.2.3` | `1.2` |
|
||||
| `{{major}}` | `v1.2.3` | `1` |
|
||||
| `{{minor}}` | `v1.2.3` | `2` |
|
||||
| `{{patch}}` | `v1.2.3` | `3` |
|
||||
| Git tag | `tag-match` | `tag-match-group` | Match | Docker tags |
|
||||
|-------------------------|------------------------------------|-------------------|----------------------|---------------------------|
|
||||
| `v1.2.3` | `\d{1,3}.\d{1,3}.\d{1,3}` | `0` | :white_check_mark: | `1.2.3`, `latest` |
|
||||
| `v2.0.8-beta.67` | `v(.*)` | `1` | :white_check_mark: | `2.0.8-beta.67`, `latest` |
|
||||
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | :white_check_mark: | `2.0`, `latest` |
|
||||
| `release1` | `\d{1,3}.\d{1,3}` | `0` | :x: | `release1` |
|
||||
| `20200110-RC2` | `\d+` | `0` | :white_check_mark: | `20200110`, `latest` |
|
||||
|
||||
### Schedule tag
|
||||
|
||||
@@ -170,6 +160,28 @@ the following expressions:
|
||||
|
||||
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
|
||||
|
||||
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
|
||||
|
@@ -74,7 +74,7 @@ describe('null', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=",
|
||||
@@ -95,7 +95,7 @@ describe('null', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=",
|
||||
@@ -124,7 +124,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=dev",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -148,7 +148,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=edge",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -171,7 +171,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=master",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -195,7 +195,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=edge",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -219,7 +219,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=dev",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -244,7 +244,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=edge",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -271,7 +271,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=dev",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -299,7 +299,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=edge",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -328,7 +328,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=edge",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -357,7 +357,7 @@ describe('push', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=master",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -377,16 +377,17 @@ describe('push tag', () => {
|
||||
} as Inputs,
|
||||
{
|
||||
version: 'release1',
|
||||
latest: false
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:release1'
|
||||
'user/app:release1',
|
||||
'user/app:latest'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=release1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -400,16 +401,17 @@ describe('push tag', () => {
|
||||
} as Inputs,
|
||||
{
|
||||
version: '20200110-RC2',
|
||||
latest: false
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:20200110-RC2'
|
||||
'user/app:20200110-RC2',
|
||||
'user/app:latest'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=20200110-RC2",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -420,55 +422,58 @@ describe('push tag', () => {
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagCoerceTag: '{{major}}',
|
||||
tagMatch: `\\d{8}`,
|
||||
tagMatchLatest: false,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '20200110',
|
||||
latest: true
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'user/app:20200110',
|
||||
'user/app:latest'
|
||||
'user/app:20200110'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=20200110",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagMatch: `(.*)-RC`,
|
||||
tagMatchGroup: 1,
|
||||
tagMatchLatest: false,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '20200110',
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'user/app:20200110'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=20200110",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
} as Inputs,
|
||||
{
|
||||
version: '1.1.1',
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:1.1.1',
|
||||
'user/app:latest'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.version=1.1.1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}.\\d{1,3}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '1.1.1',
|
||||
@@ -484,36 +489,7 @@ describe('push tag', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.version=1.1.1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSha: true,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '1.1.1',
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'org/app:1.1.1',
|
||||
'org/app:latest',
|
||||
'org/app:sha-90dd603',
|
||||
'ghcr.io/user/app:1.1.1',
|
||||
'ghcr.io/user/app:latest',
|
||||
'ghcr.io/user/app:sha-90dd603'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=1.1.1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -524,6 +500,7 @@ describe('push tag', () => {
|
||||
'event_tag_v2.0.8-beta.67.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}.\\d{1,3}-(alpha|beta).\\d{1,3}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '2.0.8-beta.67',
|
||||
@@ -539,7 +516,7 @@ describe('push tag', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=2.0.8-beta.67",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -550,7 +527,7 @@ describe('push tag', () => {
|
||||
'event_tag_v2.0.8-beta.67.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagCoerceTag: '{{major}}.{{minor}}',
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '2.0',
|
||||
@@ -566,7 +543,7 @@ describe('push tag', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=2.0",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -577,7 +554,7 @@ describe('push tag', () => {
|
||||
'event_tag_sometag.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagCoerceTag: '{{major}}.{{minor}}',
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: 'sometag',
|
||||
@@ -591,7 +568,7 @@ describe('push tag', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=sometag",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -608,7 +585,7 @@ describe('latest', () => {
|
||||
'event_tag_release1.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagLatestMatch: `^release`,
|
||||
tagMatch: `^release\\d{1,2}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: 'release1',
|
||||
@@ -622,7 +599,7 @@ describe('latest', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=release1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -633,7 +610,7 @@ describe('latest', () => {
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagLatestMatch: `^\\d`,
|
||||
tagMatch: `^\\d+-RC\\d{1,2}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '20200110-RC2',
|
||||
@@ -647,7 +624,7 @@ describe('latest', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=20200110-RC2",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -658,8 +635,7 @@ describe('latest', () => {
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagCoerceTag: '{{major}}',
|
||||
tagLatestMatch: `\\d`,
|
||||
tagMatch: `\\d{8}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '20200110',
|
||||
@@ -673,7 +649,7 @@ describe('latest', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=20200110",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -684,7 +660,7 @@ describe('latest', () => {
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagLatestMatch: `\\d{1,3}.\\d{1,3}.\\d{1,3}`,
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}.\\d{1,3}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '1.1.1',
|
||||
@@ -698,7 +674,7 @@ describe('latest', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=1.1.1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -711,46 +687,21 @@ describe('latest', () => {
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
} as Inputs,
|
||||
{
|
||||
version: '1.1.1',
|
||||
version: 'v1.1.1',
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'org/app:1.1.1',
|
||||
'org/app:v1.1.1',
|
||||
'org/app:latest',
|
||||
'ghcr.io/user/app:1.1.1',
|
||||
'ghcr.io/user/app:latest'
|
||||
'ghcr.io/user/app:v1.1.1',
|
||||
'ghcr.io/user/app:latest',
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.version=1.1.1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagLatestMatch: `2.\\d{1,3}.\\d{1,3}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '1.1.1',
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:1.1.1',
|
||||
'ghcr.io/user/app:1.1.1',
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.version=1.1.1",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=v1.1.1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
@@ -760,24 +711,49 @@ describe('latest', () => {
|
||||
'event_tag_v2.0.8-beta.67.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagLatestMatch: `^\\d{1,3}.\\d{1,3}.\\d{1,3}`,
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}.\\d{1,3}`,
|
||||
} as Inputs,
|
||||
{
|
||||
version: '2.0.8-beta.67',
|
||||
version: '2.0.8',
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'org/app:2.0.8-beta.67',
|
||||
'org/app:2.0.8',
|
||||
'org/app:latest',
|
||||
'ghcr.io/user/app:2.0.8-beta.67',
|
||||
'ghcr.io/user/app:2.0.8',
|
||||
'ghcr.io/user/app:latest'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.version=2.0.8-beta.67",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=2.0.8",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatchLatest: false,
|
||||
} as Inputs,
|
||||
{
|
||||
version: 'v1.1.1',
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:v1.1.1',
|
||||
'ghcr.io/user/app:v1.1.1',
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=v1.1.1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
@@ -805,7 +781,7 @@ describe('pull_request', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=pr-2",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=1e9249f05bfc090e0688b8fb9c1b347586add504",
|
||||
@@ -829,7 +805,7 @@ describe('pull_request', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=pr-2",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=1e9249f05bfc090e0688b8fb9c1b347586add504",
|
||||
@@ -856,7 +832,7 @@ describe('pull_request', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=pr-2",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=1e9249f05bfc090e0688b8fb9c1b347586add504",
|
||||
@@ -885,7 +861,7 @@ describe('schedule', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=nightly",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -909,7 +885,7 @@ describe('schedule', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=20200110",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -933,7 +909,7 @@ describe('schedule', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=20200110-003000",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -957,7 +933,7 @@ describe('schedule', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=nightly",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -984,7 +960,7 @@ describe('schedule', () => {
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=nightly",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
@@ -1003,19 +979,19 @@ describe('release', () => {
|
||||
images: ['user/app'],
|
||||
} as Inputs,
|
||||
{
|
||||
version: '1.1.1',
|
||||
version: 'v1.1.1',
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:1.1.1',
|
||||
'user/app:latest'
|
||||
'user/app:v1.1.1',
|
||||
'user/app:latest',
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.version=1.1.1",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=v1.1.1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
|
13
action.yml
13
action.yml
@@ -21,11 +21,16 @@ inputs:
|
||||
tag-edge-branch:
|
||||
description: 'Branch that will be tagged as edge (default repo.default_branch)'
|
||||
required: false
|
||||
tag-coerce-tag:
|
||||
description: 'Coerces Git tag to semver if possible using template'
|
||||
tag-match:
|
||||
description: 'RegExp to match against a Git tag and use match group as Docker tag'
|
||||
required: false
|
||||
tag-latest-match:
|
||||
description: 'Set latest tag only if matches with a pattern'
|
||||
tag-match-group:
|
||||
description: 'Group to get if tag-match matches (default 0)'
|
||||
default: '0'
|
||||
required: false
|
||||
tag-match-latest:
|
||||
description: 'Set latest Docker tag if tag-match matches or on Git tag event'
|
||||
default: 'true'
|
||||
required: false
|
||||
tag-schedule:
|
||||
description: 'Template to apply to schedule tag'
|
||||
|
2184
dist/index.js
generated
vendored
2184
dist/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
@@ -26,8 +26,7 @@
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/github": "^4.0.0",
|
||||
"handlebars": "^4.7.6",
|
||||
"moment": "^2.29.1",
|
||||
"semver": "^7.3.2"
|
||||
"moment": "^2.29.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.0",
|
||||
|
@@ -5,8 +5,9 @@ export interface Inputs {
|
||||
tagSha: boolean;
|
||||
tagEdge: boolean;
|
||||
tagEdgeBranch: string;
|
||||
tagCoerceTag: string;
|
||||
tagLatestMatch: string;
|
||||
tagMatch: string;
|
||||
tagMatchGroup: number;
|
||||
tagMatchLatest: boolean;
|
||||
tagSchedule: string;
|
||||
sepTags: string;
|
||||
sepLabels: string;
|
||||
@@ -19,8 +20,9 @@ export function getInputs(): Inputs {
|
||||
tagSha: /true/i.test(core.getInput('tag-sha') || 'false'),
|
||||
tagEdge: /true/i.test(core.getInput('tag-edge') || 'false'),
|
||||
tagEdgeBranch: core.getInput('tag-edge-branch'),
|
||||
tagCoerceTag: core.getInput('tag-coerce-tag'),
|
||||
tagLatestMatch: core.getInput('tag-latest-match'),
|
||||
tagMatch: core.getInput('tag-match'),
|
||||
tagMatchGroup: Number(core.getInput('tag-match-group')) || 0,
|
||||
tagMatchLatest: /true/i.test(core.getInput('tag-match-latest') || 'true'),
|
||||
tagSchedule: core.getInput('tag-schedule') || 'nightly',
|
||||
sepTags: core.getInput('sep-tags') || `\n`,
|
||||
sepLabels: core.getInput('sep-labels') || `\n`,
|
||||
|
35
src/meta.ts
35
src/meta.ts
@@ -1,6 +1,5 @@
|
||||
import * as handlebars from 'handlebars';
|
||||
import * as moment from 'moment';
|
||||
import * as semver from 'semver';
|
||||
import {Inputs} from './context';
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
import {ReposGetResponseData} from '@octokit/types';
|
||||
@@ -40,24 +39,21 @@ export class Meta {
|
||||
}
|
||||
});
|
||||
} else if (/^refs\/tags\//.test(this.context.ref)) {
|
||||
const tag = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
const sver = semver.clean(tag);
|
||||
if (this.inputs.tagCoerceTag) {
|
||||
const coerce = semver.coerce(tag);
|
||||
if (coerce) {
|
||||
version.version = handlebars.compile(this.inputs.tagCoerceTag)(coerce);
|
||||
version.latest = true;
|
||||
} else if (sver) {
|
||||
version.version = sver;
|
||||
version.latest = true;
|
||||
version.version = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
if (this.inputs.tagMatch) {
|
||||
let tagMatch;
|
||||
const isRegEx = this.inputs.tagMatch.match(/^\/(.+)\/(.*)$/);
|
||||
if (isRegEx) {
|
||||
tagMatch = version.version.match(new RegExp(isRegEx[1], isRegEx[2]));
|
||||
} else {
|
||||
version.version = tag;
|
||||
tagMatch = version.version.match(this.inputs.tagMatch);
|
||||
}
|
||||
if (tagMatch) {
|
||||
version.version = tagMatch[this.inputs.tagMatchGroup];
|
||||
version.latest = this.inputs.tagMatchLatest;
|
||||
}
|
||||
} else if (sver) {
|
||||
version.version = sver;
|
||||
version.latest = true;
|
||||
} else {
|
||||
version.version = tag;
|
||||
version.latest = this.inputs.tagMatchLatest;
|
||||
}
|
||||
} else if (/^refs\/heads\//.test(this.context.ref)) {
|
||||
version.version = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
||||
@@ -68,11 +64,6 @@ export class Meta {
|
||||
version.version = `pr-${this.context.ref.replace(/^refs\/pull\//g, '').replace(/\/merge$/g, '')}`;
|
||||
}
|
||||
|
||||
if (this.inputs.tagLatestMatch) {
|
||||
const match = version.version?.match(new RegExp(this.inputs.tagLatestMatch));
|
||||
version.latest = match !== null;
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
@@ -100,7 +91,7 @@ export class Meta {
|
||||
`org.opencontainers.image.title=${this.repo.name || ''}`,
|
||||
`org.opencontainers.image.description=${this.repo.description || ''}`,
|
||||
`org.opencontainers.image.url=${this.repo.html_url || ''}`,
|
||||
`org.opencontainers.image.source=${this.repo.clone_url || ''}`,
|
||||
`org.opencontainers.image.source=${this.repo.html_url || ''}`,
|
||||
`org.opencontainers.image.version=${this.version().version || ''}`,
|
||||
`org.opencontainers.image.created=${this.date.toISOString()}`,
|
||||
`org.opencontainers.image.revision=${this.context.sha || ''}`,
|
||||
|
Reference in New Issue
Block a user