Compare commits
95 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2af9c6a52b | ||
|
1239e23120 | ||
|
8d3d13fe48 | ||
|
ed01528979 | ||
|
c8b87a08b5 | ||
|
280367084a | ||
|
c0bab712bd | ||
|
9ceaaf86cd | ||
|
f02d9f4f9b | ||
|
400bd87b5a | ||
|
e4fc7e9e11 | ||
|
9583a0f404 | ||
|
5e6d5157fb | ||
|
e09df4df3c | ||
|
72e5d60481 | ||
|
ae431178c1 | ||
|
34ebfd6e6b | ||
|
94641ff1bb | ||
|
40bfc8b527 | ||
|
2e1a5c7fa4 | ||
|
1a678de43d | ||
|
84b9e75d44 | ||
|
f39f06a624 | ||
|
36ae18e02c | ||
|
e87dd9466c | ||
|
9da1e66de9 | ||
|
521a3c5ada | ||
|
7433b42479 | ||
|
1a8a264b95 | ||
|
e04b4d01a9 | ||
|
ac90ddf06e | ||
|
972129059a | ||
|
b909bd34ef | ||
|
72654174f7 | ||
|
4545671ec8 | ||
|
5c38e5df03 | ||
|
2cbde9dffa | ||
|
2f83320d17 | ||
|
9be43f076d | ||
|
d541d2c17f | ||
|
cffefcd230 | ||
|
00e310993c | ||
|
e696b8439a | ||
|
b334567bf3 | ||
|
7b49f7ed90 | ||
|
e08ef4ca63 | ||
|
5f29dbc7d7 | ||
|
94e634192d | ||
|
cae03854eb | ||
|
0a412843f8 | ||
|
9ae6899cfa | ||
|
db66d4df79 | ||
|
b500d9c7b5 | ||
|
aa3823e012 | ||
|
a4739af83c | ||
|
10e9d5d585 | ||
|
3479bd5aaa | ||
|
c48ac80f46 | ||
|
805449f25e | ||
|
55d3462f05 | ||
|
7040b59aa5 | ||
|
3ae5afe041 | ||
|
b747b8aaa7 | ||
|
585ab8356c | ||
|
9de4428611 | ||
|
4c2760ba7a | ||
|
ef12c77b87 | ||
|
c53f88523a | ||
|
6b4bf4724e | ||
|
d48c7d2917 | ||
|
7cb65aaacb | ||
|
0dca12c226 | ||
|
6f270f37d4 | ||
|
2860e42b1f | ||
|
6a86fe1739 | ||
|
86dc87790d | ||
|
b3281c85e6 | ||
|
9ba75ef142 | ||
|
a017e545d7 | ||
|
8adbcfe00d | ||
|
1c9398a965 | ||
|
9fad2f37d6 | ||
|
7ef05591b5 | ||
|
e8ce48988f | ||
|
009f84cd69 | ||
|
dd2e615c98 | ||
|
f552880d7c | ||
|
8d7fa04f07 | ||
|
52c4b1ad0c | ||
|
b4c9b2116e | ||
|
5c140cfb94 | ||
|
6cc07472c0 | ||
|
5ecce77816 | ||
|
741aa98f85 | ||
|
4a3b775794 |
@@ -1 +1,2 @@
|
|||||||
node_modules
|
/coverage
|
||||||
|
/node_modules
|
||||||
|
37
.github/CONTRIBUTING.md
vendored
37
.github/CONTRIBUTING.md
vendored
@@ -2,33 +2,20 @@
|
|||||||
|
|
||||||
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
|
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
|
||||||
|
|
||||||
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
|
Contributions to this project are [released](https://docs.github.com/en/github/site-policy/github-terms-of-service#6-contributions-under-repository-license)
|
||||||
|
to the public under the [project's open source license](LICENSE).
|
||||||
|
|
||||||
## Submitting a pull request
|
## Submitting a pull request
|
||||||
|
|
||||||
1. [Fork](https://github.com/crazy-max/ghaction-docker-meta/fork) and clone the repository
|
1. [Fork](https://github.com/docker/metadata-action/fork) and clone the repository
|
||||||
2. Configure and install the dependencies: `yarn install`
|
2. Configure and install the dependencies: `yarn install`
|
||||||
3. Make sure the tests pass on your machine: `yarn run test`
|
3. Create a new branch: `git checkout -b my-branch-name`
|
||||||
4. Create a new branch: `git checkout -b my-branch-name`
|
4. Make your changes
|
||||||
5. Make your change, add tests, and make sure the tests still pass
|
5. Make sure the tests pass: `docker buildx bake test`
|
||||||
6. Run pre-checkin: `yarn run pre-checkin`
|
6. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
|
||||||
7. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-docker-meta/compare)
|
7. Validate all code has correctly formatted and built: `docker buildx bake validate`
|
||||||
8. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
8. Push to your fork and [submit a pull request](https://github.com/docker/metadata-action/compare)
|
||||||
|
9. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
||||||
## Container based developer flow
|
|
||||||
|
|
||||||
If you don't want to maintain a Node developer environment that fits this project you can use containerized commands instead of invoking yarn directly.
|
|
||||||
|
|
||||||
```
|
|
||||||
# format code and build javascript artifacts
|
|
||||||
docker buildx bake pre-checkin
|
|
||||||
|
|
||||||
# validate all code has correctly formatted and built
|
|
||||||
docker buildx bake validate
|
|
||||||
|
|
||||||
# run tests
|
|
||||||
docker buildx bake test
|
|
||||||
```
|
|
||||||
|
|
||||||
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
||||||
|
|
||||||
@@ -41,5 +28,5 @@ Here are a few things you can do that will increase the likelihood of your pull
|
|||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
||||||
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
|
- [Using Pull Requests](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
|
||||||
- [GitHub Help](https://help.github.com)
|
- [GitHub Help](https://docs.github.com/en)
|
||||||
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,2 +0,0 @@
|
|||||||
github: crazy-max
|
|
||||||
custom: https://www.paypal.me/crazyws
|
|
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -13,11 +13,11 @@ about: Create a report to help us improve
|
|||||||
|
|
||||||
#### Expected behaviour
|
#### Expected behaviour
|
||||||
|
|
||||||
> Tell me what should happen
|
> Tell us what should happen
|
||||||
|
|
||||||
#### Actual behaviour
|
#### Actual behaviour
|
||||||
|
|
||||||
> Tell me what happens instead
|
> Tell us what happens instead
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
@@ -30,4 +30,5 @@ about: Create a report to help us improve
|
|||||||
|
|
||||||
### Logs
|
### Logs
|
||||||
|
|
||||||
> Download the [log file of your build](https://help.github.com/en/actions/configuring-and-managing-workflows/managing-a-workflow-run#downloading-logs) and [attach it](https://help.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.
|
> Download the [log file of your build](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
|
||||||
|
> and [attach it](https://docs.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.
|
||||||
|
13
.github/SUPPORT.md
vendored
13
.github/SUPPORT.md
vendored
@@ -1,10 +1,13 @@
|
|||||||
# Support [](https://isitmaintained.com/project/crazy-max/ghaction-docker-meta)
|
# Support [](https://isitmaintained.com/project/docker/metadata-action)
|
||||||
|
|
||||||
## Reporting an issue
|
## Reporting an issue
|
||||||
|
|
||||||
Please do a search in [open issues](https://github.com/crazy-max/ghaction-docker-meta/issues?utf8=%E2%9C%93&q=) to see if the issue or feature request has already been filed.
|
Please do a search in [open issues](https://github.com/docker/metadata-action/issues?utf8=%E2%9C%93&q=) to see if the
|
||||||
|
issue or feature request has already been filed.
|
||||||
|
|
||||||
If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment.
|
If you find your issue already exists, make relevant comments and add your
|
||||||
|
[reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place
|
||||||
|
of a "+1" comment.
|
||||||
|
|
||||||
:+1: - upvote
|
:+1: - upvote
|
||||||
|
|
||||||
@@ -21,9 +24,9 @@ File a single issue per problem and feature request.
|
|||||||
|
|
||||||
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
|
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
|
||||||
|
|
||||||
You are now ready to [create a new issue](https://github.com/crazy-max/ghaction-docker-meta/issues/new/choose)!
|
You are now ready to [create a new issue](https://github.com/docker/metadata-action/issues/new/choose)!
|
||||||
|
|
||||||
## Closure policy
|
## Closure policy
|
||||||
|
|
||||||
* Issues that don't have the information requested above (when applicable) will be closed immediately and the poster directed to the support guidelines.
|
* Issues that don't have the information requested above (when applicable) will be closed immediately and the poster directed to the support guidelines.
|
||||||
* Issues that go a week without a response from original poster are subject to closure at my discretion.
|
* Issues that go a week without a response from original poster are subject to closure at our discretion.
|
||||||
|
BIN
.github/ghaction-docker-meta.png
vendored
BIN
.github/ghaction-docker-meta.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 6.5 KiB |
77
.github/labels.yml
vendored
77
.github/labels.yml
vendored
@@ -1,77 +0,0 @@
|
|||||||
## more info https://github.com/crazy-max/ghaction-github-labeler
|
|
||||||
- # automerge
|
|
||||||
name: ":bell: automerge"
|
|
||||||
color: "8f4fbc"
|
|
||||||
description: ""
|
|
||||||
- # bot
|
|
||||||
name: ":robot: bot"
|
|
||||||
color: "69cde9"
|
|
||||||
description: ""
|
|
||||||
- # bug
|
|
||||||
name: ":bug: bug"
|
|
||||||
color: "b60205"
|
|
||||||
description: ""
|
|
||||||
- # dependencies
|
|
||||||
name: ":game_die: dependencies"
|
|
||||||
color: "0366d6"
|
|
||||||
description: ""
|
|
||||||
- # documentation
|
|
||||||
name: ":memo: documentation"
|
|
||||||
color: "c5def5"
|
|
||||||
description: ""
|
|
||||||
- # duplicate
|
|
||||||
name: ":busts_in_silhouette: duplicate"
|
|
||||||
color: "cccccc"
|
|
||||||
description: ""
|
|
||||||
- # enhancement
|
|
||||||
name: ":sparkles: enhancement"
|
|
||||||
color: "0054ca"
|
|
||||||
description: ""
|
|
||||||
- # feature request
|
|
||||||
name: ":bulb: feature request"
|
|
||||||
color: "0e8a16"
|
|
||||||
description: ""
|
|
||||||
- # feedback
|
|
||||||
name: ":mega: feedback"
|
|
||||||
color: "03a9f4"
|
|
||||||
description: ""
|
|
||||||
- # future maybe
|
|
||||||
name: ":rocket: future maybe"
|
|
||||||
color: "fef2c0"
|
|
||||||
description: ""
|
|
||||||
- # good first issue
|
|
||||||
name: ":hatching_chick: good first issue"
|
|
||||||
color: "7057ff"
|
|
||||||
description: ""
|
|
||||||
- # help wanted
|
|
||||||
name: ":pray: help wanted"
|
|
||||||
color: "4caf50"
|
|
||||||
description: ""
|
|
||||||
- # hold
|
|
||||||
name: ":hand: hold"
|
|
||||||
color: "24292f"
|
|
||||||
description: ""
|
|
||||||
- # invalid
|
|
||||||
name: ":no_entry_sign: invalid"
|
|
||||||
color: "e6e6e6"
|
|
||||||
description: ""
|
|
||||||
- # maybe bug
|
|
||||||
name: ":interrobang: maybe bug"
|
|
||||||
color: "ff5722"
|
|
||||||
description: ""
|
|
||||||
- # needs more info
|
|
||||||
name: ":thinking: needs more info"
|
|
||||||
color: "795548"
|
|
||||||
description: ""
|
|
||||||
- # question
|
|
||||||
name: ":question: question"
|
|
||||||
color: "3f51b5"
|
|
||||||
description: ""
|
|
||||||
- # upstream
|
|
||||||
name: ":eyes: upstream"
|
|
||||||
color: "fbca04"
|
|
||||||
description: ""
|
|
||||||
- # wontfix
|
|
||||||
name: ":coffin: wontfix"
|
|
||||||
color: "ffffff"
|
|
||||||
description: ""
|
|
BIN
.github/metadata-action.png
vendored
Normal file
BIN
.github/metadata-action.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
18
.github/stale.yml
vendored
18
.github/stale.yml
vendored
@@ -1,18 +0,0 @@
|
|||||||
# Number of days of inactivity before an issue becomes stale
|
|
||||||
daysUntilStale: 30
|
|
||||||
# Number of days of inactivity before a stale issue is closed
|
|
||||||
daysUntilClose: 7
|
|
||||||
# Issues with these labels will never be considered stale
|
|
||||||
exemptLabels:
|
|
||||||
- ":hand: hold"
|
|
||||||
# Set to true to ignore issues in a milestone (defaults to false)
|
|
||||||
exemptMilestones: true
|
|
||||||
# Label to use when marking an issue as stale
|
|
||||||
staleLabel: ":skull: stale"
|
|
||||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
||||||
markComment: >
|
|
||||||
This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
||||||
closeComment: false
|
|
161
.github/workflows/ci.yml
vendored
161
.github/workflows/ci.yml
vendored
@@ -5,10 +5,14 @@ on:
|
|||||||
- cron: '0 */4 * * *' # every 4 hours
|
- cron: '0 */4 * * *' # every 4 hours
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*.*.*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_IMAGE: localhost:5000/name/app
|
DOCKER_IMAGE: localhost:5000/name/app
|
||||||
@@ -19,7 +23,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -27,7 +31,12 @@ jobs:
|
|||||||
images: |
|
images: |
|
||||||
${{ env.DOCKER_IMAGE }}
|
${{ env.DOCKER_IMAGE }}
|
||||||
ghcr.io/name/app
|
ghcr.io/name/app
|
||||||
tag-sha: true
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
type=sha
|
||||||
|
|
||||||
tag-schedule:
|
tag-schedule:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -42,7 +51,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -50,8 +59,12 @@ jobs:
|
|||||||
images: |
|
images: |
|
||||||
${{ env.DOCKER_IMAGE }}
|
${{ env.DOCKER_IMAGE }}
|
||||||
ghcr.io/name/app
|
ghcr.io/name/app
|
||||||
tag-sha: true
|
tags: |
|
||||||
tag-schedule: ${{ matrix.tag-schedule }}
|
type=schedule,pattern=${{ matrix.tag-schedule }}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
type=sha
|
||||||
|
|
||||||
tag-match:
|
tag-match:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -59,16 +72,16 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- tag-match: '\d{1,3}.\d{1,3}.\d{1,3}'
|
- tag-match: '\d.\d.\d'
|
||||||
tag-match-group: '0'
|
tag-match-group: '0'
|
||||||
- tag-match: '\d{1,3}.\d{1,3}'
|
- tag-match: '\d.\d'
|
||||||
tag-match-group: '0'
|
tag-match-group: '0'
|
||||||
- tag-match: 'v(.*)'
|
- tag-match: 'v(.*)'
|
||||||
tag-match-group: '1'
|
tag-match-group: '1'
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -76,9 +89,81 @@ jobs:
|
|||||||
images: |
|
images: |
|
||||||
${{ env.DOCKER_IMAGE }}
|
${{ env.DOCKER_IMAGE }}
|
||||||
ghcr.io/name/app
|
ghcr.io/name/app
|
||||||
tag-sha: true
|
tags: |
|
||||||
tag-match: ${{ matrix.tag-match }}
|
type=schedule
|
||||||
tag-match-group: ${{ matrix.tag-match-group }}
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
type=match,"pattern=${{ matrix.tag-match }}",group=${{ matrix.tag-match-group }}
|
||||||
|
type=sha
|
||||||
|
|
||||||
|
tag-semver:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
flavor-latest:
|
||||||
|
- "auto"
|
||||||
|
- "true"
|
||||||
|
- "false"
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ env.DOCKER_IMAGE }}
|
||||||
|
ghcr.io/name/app
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{raw}}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
||||||
|
type=sha
|
||||||
|
flavor: |
|
||||||
|
latest=${{ matrix.flavor-latest }}
|
||||||
|
|
||||||
|
flavor:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ env.DOCKER_IMAGE }}
|
||||||
|
ghcr.io/name/app
|
||||||
|
flavor: |
|
||||||
|
prefix=foo-
|
||||||
|
suffix=-bar
|
||||||
|
|
||||||
|
labels:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ env.DOCKER_IMAGE }}
|
||||||
|
ghcr.io/name/app
|
||||||
|
labels: |
|
||||||
|
maintainer=CrazyMax
|
||||||
|
org.opencontainers.image.title=MyCustomTitle
|
||||||
|
org.opencontainers.image.description=Another description
|
||||||
|
org.opencontainers.image.vendor=MyCompany
|
||||||
|
|
||||||
docker-push:
|
docker-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -90,15 +175,22 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: docker_meta
|
id: docker_meta
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
images: ${{ env.DOCKER_IMAGE }}
|
images: ${{ env.DOCKER_IMAGE }}
|
||||||
tag-sha: true
|
tags: |
|
||||||
tag-match: \\d{1,3}.\\d{1,3}.\\d{1,3}
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern=v{{version}}
|
||||||
|
type=semver,pattern=v{{major}}.{{minor}}
|
||||||
|
type=semver,pattern=v{{major}}
|
||||||
|
type=sha
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
@@ -130,3 +222,42 @@ jobs:
|
|||||||
name: Dump context
|
name: Dump context
|
||||||
if: always()
|
if: always()
|
||||||
uses: crazy-max/ghaction-dump-context@v1
|
uses: crazy-max/ghaction-dump-context@v1
|
||||||
|
|
||||||
|
bake:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: docker_meta
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ env.DOCKER_IMAGE }}
|
||||||
|
ghcr.io/name/app
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: docker/bake-action@v1
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/docker-bake.hcl
|
||||||
|
${{ steps.docker_meta.outputs.bake-file }}
|
||||||
|
targets: |
|
||||||
|
release
|
||||||
|
20
.github/workflows/labels.yml
vendored
20
.github/workflows/labels.yml
vendored
@@ -1,20 +0,0 @@
|
|||||||
name: labels
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
paths:
|
|
||||||
- '.github/labels.yml'
|
|
||||||
- '.github/workflows/labels.yml'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
labeler:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2.3.3
|
|
||||||
-
|
|
||||||
name: Run Labeler
|
|
||||||
uses: crazy-max/ghaction-github-labeler@v3.1.0
|
|
36
.github/workflows/test.yml
vendored
36
.github/workflows/test.yml
vendored
@@ -5,42 +5,30 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
- 'releases/v*'
|
- 'releases/v*'
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
branches:
|
||||||
- '**.md'
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-containerized:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2.3.3
|
|
||||||
-
|
|
||||||
name: Validate
|
|
||||||
run: docker buildx bake validate
|
|
||||||
-
|
|
||||||
name: Test
|
|
||||||
run: docker buildx bake test
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Install
|
name: Validate
|
||||||
run: yarn install
|
uses: docker/bake-action@v1
|
||||||
|
with:
|
||||||
|
targets: validate
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
run: yarn run test
|
uses: docker/bake-action@v1
|
||||||
|
with:
|
||||||
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1.0.14
|
uses: codecov/codecov-action@v1
|
||||||
if: success()
|
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
|
27
CHANGELOG.md
27
CHANGELOG.md
@@ -1,27 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## 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
|
|
||||||
|
|
||||||
## 1.2.0 (2020/10/26)
|
|
||||||
|
|
||||||
* Coerces Git tag to semver (#3)
|
|
||||||
|
|
||||||
## 1.1.0 (2020/10/25)
|
|
||||||
|
|
||||||
* Allow to templatize schedule tag (#1)
|
|
||||||
* Allow to disable edge branch tagging (#2)
|
|
||||||
|
|
||||||
## 1.0.0 (2020/10/25)
|
|
||||||
|
|
||||||
* Initial version
|
|
42
Dockerfile
42
Dockerfile
@@ -1,42 +0,0 @@
|
|||||||
#syntax=docker/dockerfile:1.1-experimental
|
|
||||||
|
|
||||||
FROM node:12 AS deps
|
|
||||||
WORKDIR /src
|
|
||||||
COPY package.json yarn.lock ./
|
|
||||||
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn \
|
|
||||||
yarn install
|
|
||||||
|
|
||||||
FROM scratch AS update-yarn
|
|
||||||
COPY --from=deps /src/yarn.lock /
|
|
||||||
|
|
||||||
FROM deps AS validate-yarn
|
|
||||||
COPY .git .git
|
|
||||||
RUN status=$(git status --porcelain -- yarn.lock); if [ -n "$status" ]; then echo $status; exit 1; fi
|
|
||||||
|
|
||||||
FROM deps AS base
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
FROM base AS build
|
|
||||||
RUN yarn build
|
|
||||||
|
|
||||||
FROM deps AS test
|
|
||||||
COPY . .
|
|
||||||
RUN yarn run test
|
|
||||||
|
|
||||||
FROM base AS run-format
|
|
||||||
RUN yarn run format
|
|
||||||
|
|
||||||
FROM scratch AS format
|
|
||||||
COPY --from=run-format /src/src/*.ts /src/
|
|
||||||
|
|
||||||
FROM base AS validate-format
|
|
||||||
RUN yarn run format-check
|
|
||||||
|
|
||||||
FROM scratch AS dist
|
|
||||||
COPY --from=build /src/dist/ /dist/
|
|
||||||
|
|
||||||
FROM build AS validate-build
|
|
||||||
RUN status=$(git status --porcelain -- dist); if [ -n "$status" ]; then echo $status; exit 1; fi
|
|
||||||
|
|
||||||
FROM base AS dev
|
|
||||||
ENTRYPOINT ["bash"]
|
|
204
LICENSE
204
LICENSE
@@ -1,21 +1,191 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2020 CrazyMax
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
https://www.apache.org/licenses/
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
1. Definitions.
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
the copyright owner that is granting the License.
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
Copyright 2013-2018 Docker, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
617
README.md
617
README.md
@@ -1,66 +1,56 @@
|
|||||||
[](https://github.com/crazy-max/ghaction-docker-meta/releases/latest)
|
[](https://github.com/docker/metadata-action/releases/latest)
|
||||||
[](https://github.com/marketplace/actions/docker-meta)
|
[](https://github.com/marketplace/actions/docker-metadata-action)
|
||||||
[](https://github.com/crazy-max/ghaction-docker-meta/actions?workflow=test)
|
[](https://github.com/docker/metadata-action/actions?workflow=test)
|
||||||
[](https://codecov.io/gh/crazy-max/ghaction-docker-meta)
|
[](https://codecov.io/gh/docker/metadata-action)
|
||||||
[](https://github.com/sponsors/crazy-max)
|
|
||||||
[](https://www.paypal.me/crazyws)
|
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
GitHub Action to extract metadata (tags, labels) for Docker. This action is particularly useful if used with
|
GitHub Action to extract metadata (tags, labels) for Docker. This action is particularly useful if used with
|
||||||
[Docker Build Push](https://github.com/docker/build-push-action) action.
|
[Docker Build Push](https://github.com/docker/build-push-action) action.
|
||||||
|
|
||||||
If you are interested, [check out](https://git.io/Je09Y) my other :octocat: GitHub Actions!
|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
___
|
___
|
||||||
|
|
||||||
* [Features](#features)
|
|
||||||
* [Overview](#overview)
|
|
||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
|
* [Basic](#basic)
|
||||||
|
* [Semver](#semver)
|
||||||
|
* [Bake definition](#bake-definition)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [outputs](#outputs)
|
* [outputs](#outputs)
|
||||||
|
* [`flavor` input](#flavor-input)
|
||||||
|
* [`tags` input](#tags-input)
|
||||||
|
* [`type=schedule`](#typeschedule)
|
||||||
|
* [`type=semver`](#typesemver)
|
||||||
|
* [`type=match`](#typematch)
|
||||||
|
* [`type=edge`](#typeedge)
|
||||||
|
* [`type=ref`](#typeref)
|
||||||
|
* [`type=raw`](#typeraw)
|
||||||
|
* [`type=sha`](#typesha)
|
||||||
* [Notes](#notes)
|
* [Notes](#notes)
|
||||||
* [`tag-match` examples](#tag-match-examples)
|
* [Latest tag](#latest-tag)
|
||||||
* [Schedule tag](#schedule-tag)
|
* [Global expressions](#global-expressions)
|
||||||
|
* [Major version zero](#major-version-zero)
|
||||||
|
* [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)
|
|
||||||
* [License](#license)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
* Docker tags generated from GitHub action event and Git metadata
|
|
||||||
* [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md) used to generate Docker labels
|
|
||||||
* [Handlebars template](https://handlebarsjs.com/guide/) to apply to schedule tag
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
| Event | Ref | Commit SHA | Docker Tags |
|
|
||||||
|-----------------|-------------------------------|------------|-------------------------------------|
|
|
||||||
| `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/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` |
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
### Basic
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
|
||||||
- cron: '0 10 * * *' # everyday at 10am
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- 'master'
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@@ -71,19 +61,10 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: docker_meta
|
id: meta
|
||||||
uses: crazy-max/ghaction-docker-meta@v1
|
uses: docker/metadata-action@v3
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
tag-sha: true
|
|
||||||
tag-match: v(.*)
|
|
||||||
tag-match-group: 1
|
|
||||||
-
|
|
||||||
name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
@@ -96,11 +77,163 @@ jobs:
|
|||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/386
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
||||||
|
|
||||||
|
| Event | Ref | Docker Tags |
|
||||||
|
|-----------------|-------------------------------|-------------------------------------|
|
||||||
|
| `pull_request` | `refs/pull/2/merge` | `pr-2` |
|
||||||
|
| `push` | `refs/heads/master` | `master` |
|
||||||
|
| `push` | `refs/heads/releases/v1` | `releases-v1` |
|
||||||
|
| `push tag` | `refs/tags/v1.2.3` | `v1.2.3`, `latest` |
|
||||||
|
| `push tag` | `refs/tags/v2.0.8-beta.67` | `v2.0.8-beta.67`, `latest` |
|
||||||
|
|
||||||
|
### Semver
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
||||||
|
|
||||||
|
| Event | Ref | Docker Tags |
|
||||||
|
|-----------------|-------------------------------|-------------------------------------|
|
||||||
|
| `pull_request` | `refs/pull/2/merge` | `pr-2` |
|
||||||
|
| `push` | `refs/heads/master` | `master` |
|
||||||
|
| `push` | `refs/heads/releases/v1` | `releases-v1` |
|
||||||
|
| `push tag` | `refs/tags/v1.2.3` | `1.2.3`, `1.2`, `latest` |
|
||||||
|
| `push tag` | `refs/tags/v2.0.8-beta.67` | `2.0.8-beta.67` |
|
||||||
|
|
||||||
|
### Bake definition
|
||||||
|
|
||||||
|
This action also handles a bake definition file that can be used with the
|
||||||
|
[Docker Bake action](https://github.com/docker/bake-action). You just have to declare an empty target named
|
||||||
|
`docker-metadata-action` and inherit from it.
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
// docker-bake.hcl
|
||||||
|
target "docker-metadata-action" {}
|
||||||
|
|
||||||
|
target "build" {
|
||||||
|
inherits = ["docker-metadata-action"]
|
||||||
|
context = "./"
|
||||||
|
dockerfile = "Dockerfile"
|
||||||
|
platforms = ["linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/386", "linux/ppc64le"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=sha
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: docker/bake-action@v1
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./docker-bake.hcl
|
||||||
|
${{ steps.meta.outputs.bake-file }}
|
||||||
|
targets: build
|
||||||
|
```
|
||||||
|
|
||||||
|
Content of `${{ steps.meta.outputs.bake-file }}` file will look like this with `refs/tags/v1.2.3` ref:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"target": {
|
||||||
|
"docker-metadata-action": {
|
||||||
|
"tags": [
|
||||||
|
"name/app:1.2.3",
|
||||||
|
"name/app:1.2",
|
||||||
|
"name/app:sha-90dd603",
|
||||||
|
"name/app:latest"
|
||||||
|
],
|
||||||
|
"labels": {
|
||||||
|
"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": "1.2.3",
|
||||||
|
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses": "MIT"
|
||||||
|
},
|
||||||
|
"args": {
|
||||||
|
"DOCKER_META_IMAGES": "name/app",
|
||||||
|
"DOCKER_META_VERSION": "1.2.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
@@ -109,20 +242,28 @@ jobs:
|
|||||||
|
|
||||||
Following inputs can be used as `step.with` keys
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
|
> `List` type is a newline-delimited string
|
||||||
|
> ```yaml
|
||||||
|
> labels: |
|
||||||
|
> org.opencontainers.image.title=MyCustomTitle
|
||||||
|
> org.opencontainers.image.description=Another description
|
||||||
|
> org.opencontainers.image.vendor=MyCompany
|
||||||
|
> ```
|
||||||
|
|
||||||
|
> `CSV` type is a comma-delimited string
|
||||||
|
> ```yaml
|
||||||
|
> images: name/app,ghcr.io/name/app
|
||||||
|
> ```
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|---------------------|----------|------------------------------------|
|
|---------------------|----------|------------------------------------|
|
||||||
| `images` | List/CSV | List of Docker images to use as base name for tags |
|
| `images` | List/CSV | List of Docker images to use as base name for tags |
|
||||||
| `tag-sha` | Bool | Add git short SHA as Docker tag (default `false`) |
|
| `tags` | List | List of [tags](#tags-input) as key-value pair attributes |
|
||||||
| `tag-edge` | Bool | Enable edge branch tagging (default `false`) |
|
| `flavor` | List | [Flavor](#flavor-input) to apply |
|
||||||
| `tag-edge-branch` | String | Branch that will be tagged as edge (default `repo.default_branch`) |
|
| `labels` | List | List of custom labels |
|
||||||
| `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 (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-tags` | String | Separator to use for tags output (default `\n`) |
|
||||||
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
|
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
|
||||||
|
| `bake-target` | String | Bake target name (default `docker-metadata-action`) |
|
||||||
> List/CSV type can be a newline or comma delimited string
|
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
@@ -130,32 +271,337 @@ Following outputs are available
|
|||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|---------------|---------|---------------------------------------|
|
|---------------|---------|---------------------------------------|
|
||||||
| `version` | String | Generated Docker image version |
|
| `version` | String | Docker image version |
|
||||||
| `tags` | String | Generated Docker tags |
|
| `tags` | String | Docker tags |
|
||||||
| `labels` | String | Generated Docker labels |
|
| `labels` | String | Docker labels |
|
||||||
|
| `bake-file` | File | [Bake definition file](https://github.com/docker/buildx#file-definition) path |
|
||||||
|
|
||||||
|
## `flavor` input
|
||||||
|
|
||||||
|
`flavor` defines a global behavior for [`tags`](#tags-input):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
flavor: |
|
||||||
|
latest=auto
|
||||||
|
prefix=
|
||||||
|
suffix=
|
||||||
|
```
|
||||||
|
|
||||||
|
* `latest=<auto|true|false>`: Handle [latest tag](#latest-tag) (default `auto`)
|
||||||
|
* `prefix=<string>`: A global prefix for each generated tag
|
||||||
|
* `suffix=<string>`: A global suffix for each generated tag
|
||||||
|
|
||||||
|
## `tags` input
|
||||||
|
|
||||||
|
`tags` is the core input of this action as everything related to it will reflect the output metadata. This one is in
|
||||||
|
the form of a key-value pair list in CSV format to remove limitations intrinsically linked to GitHub Actions
|
||||||
|
(only string format is handled in the input fields). Here is an example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
```
|
||||||
|
|
||||||
|
Each entry is defined by a `type`, which are:
|
||||||
|
|
||||||
|
* [`type=schedule`](#typeschedule)
|
||||||
|
* [`type=semver`](#typesemver)
|
||||||
|
* [`type=match`](#typematch)
|
||||||
|
* [`type=edge`](#typeedge)
|
||||||
|
* [`type=ref`](#typeref)
|
||||||
|
* [`type=raw`](#typeraw)
|
||||||
|
* [`type=sha`](#typesha)
|
||||||
|
|
||||||
|
And global attributes:
|
||||||
|
|
||||||
|
* `enable=<true|false>` enable this entry (default `true`)
|
||||||
|
* `priority=<number>` priority to manage the order of tags
|
||||||
|
* `prefix=<string>` add prefix
|
||||||
|
* `suffix=<string>` add suffix
|
||||||
|
|
||||||
|
Default entries if `tags` input is empty:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=schedule`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=schedule
|
||||||
|
# default
|
||||||
|
type=schedule,pattern=nightly
|
||||||
|
# handlebars
|
||||||
|
type=schedule,pattern={{date 'YYYYMMDD'}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Will be used on [schedule event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule).
|
||||||
|
|
||||||
|
`pattern` is a specially crafted attribute to support [Handlebars template](https://handlebarsjs.com/guide/) with
|
||||||
|
the following expressions:
|
||||||
|
* `date 'format'` ; render date by its [moment format](https://momentjs.com/docs/#/displaying/format/)
|
||||||
|
|
||||||
|
| Pattern | Output |
|
||||||
|
|--------------------------|----------------------|
|
||||||
|
| `nightly` | `nightly` |
|
||||||
|
| `{{date 'YYYYMMDD'}}` | `20210326` |
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=schedule,enable=true,priority=1000,prefix=,suffix=,pattern=nightly
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=semver`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
# use custom value instead of git tag
|
||||||
|
type=semver,pattern={{version}},value=v1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
|
||||||
|
and requires a valid Git tag [semver](https://semver.org/) but you can also use a custom value through `value`
|
||||||
|
attribute.
|
||||||
|
|
||||||
|
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
|
||||||
|
* `raw` ; the actual semver
|
||||||
|
* `version` ; shorthand for `{{major}}.{{minor}}.{{patch}}` (can include pre-release)
|
||||||
|
* `major` ; major version identifier
|
||||||
|
* `minor` ; minor version identifier
|
||||||
|
* `patch` ; patch version identifier
|
||||||
|
|
||||||
|
| Git tag | Pattern | Output |
|
||||||
|
|--------------------|----------------------------------------------------------|----------------------|
|
||||||
|
| `v1.2.3` | `{{raw}}` | `v1.2.3` |
|
||||||
|
| `v1.2.3` | `{{version}}` | `1.2.3` |
|
||||||
|
| `v1.2.3` | `{{major}}.{{minor}}` | `1.2` |
|
||||||
|
| `v1.2.3` | `v{{major}}` | `v1` |
|
||||||
|
| `v1.2.3` | `{{minor}}` | `2` |
|
||||||
|
| `v1.2.3` | `{{patch}}` | `3` |
|
||||||
|
| `v2.0.8-beta.67` | `{{raw}}` | `2.0.8-beta.67`* |
|
||||||
|
| `v2.0.8-beta.67` | `{{version}}` | `2.0.8-beta.67` |
|
||||||
|
| `v2.0.8-beta.67` | `{{major}}.{{minor}}` | `2.0.8-beta.67`* |
|
||||||
|
|
||||||
|
> *Pre-release (rc, beta, alpha) will only extend `{{version}}` as tag because they are updated frequently,
|
||||||
|
> and contain many breaking changes that are (by the author's design) not yet fit for public consumption.
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=semver,enable=true,priority=900,prefix=,suffix=,pattern=,value=
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=match`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=match,pattern=\d.\d.\d
|
||||||
|
# define match group
|
||||||
|
type=match,pattern=v(.*),group=1
|
||||||
|
# use custom value instead of git tag
|
||||||
|
type=match,pattern=v(.*),group=1,value=v1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Can create a regular expression for matching Git tag with a pattern and capturing group. Will be used on a
|
||||||
|
[push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push) but you can also use
|
||||||
|
a custom value through `value` attribute.
|
||||||
|
|
||||||
|
| Git tag | Pattern | Group | Output |
|
||||||
|
|-------------------------|-------------------------------|---------|------------------------|
|
||||||
|
| `v1.2.3` | `\d.\d.\d` | `0` | `1.2.3` |
|
||||||
|
| `v2.0.8-beta.67` | `v(.*)` | `1` | `2.0.8-beta.67` |
|
||||||
|
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | `2.0` |
|
||||||
|
| `20200110-RC2` | `\d+` | `0` | `20200110` |
|
||||||
|
| `p1/v1.2.3` | `p1-v(\d.\d.\d)` | `1` | `1.2.3` |
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=match,enable=true,priority=800,prefix=,suffix=,pattern=,group=0,value=
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=edge`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=edge
|
||||||
|
# define default branch
|
||||||
|
type=edge,branch=main
|
||||||
|
```
|
||||||
|
|
||||||
|
An `edge` tag reflects the last commit of the active branch on your Git repository. I usually prefer to use `edge`
|
||||||
|
as a Docker tag for a better distinction or common pattern. This is also used by official images
|
||||||
|
like [Alpine](https://hub.docker.com/_/alpine).
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=edge,enable=true,priority=700,prefix=,suffix=,branch=$repo.default_branch
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=ref`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# branch event
|
||||||
|
type=ref,event=branch
|
||||||
|
# tag event
|
||||||
|
type=ref,event=tag
|
||||||
|
# pull request event
|
||||||
|
type=ref,event=pr
|
||||||
|
```
|
||||||
|
|
||||||
|
This type handles Git ref (or reference) for the following events:
|
||||||
|
* `branch` ; eg. `refs/heads/master`
|
||||||
|
* `tag` ; eg. `refs/tags/v1.0.0`
|
||||||
|
* `pr` ; eg. `refs/pull/318/merge`
|
||||||
|
|
||||||
|
| Event | Ref | Output |
|
||||||
|
|-----------------|-------------------------------|-------------------------------|
|
||||||
|
| `pull_request` | `refs/pull/2/merge` | `pr-2` |
|
||||||
|
| `push` | `refs/heads/master` | `master` |
|
||||||
|
| `push` | `refs/heads/my/branch` | `my-branch` |
|
||||||
|
| `push tag` | `refs/tags/v1.2.3` | `v1.2.3` |
|
||||||
|
| `push tag` | `refs/tags/v2.0.8-beta.67` | `v2.0.8-beta.67` |
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# branch event
|
||||||
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=
|
||||||
|
# tag event
|
||||||
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=
|
||||||
|
# pull request event
|
||||||
|
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=raw`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=raw,value=foo
|
||||||
|
type=raw,value=bar
|
||||||
|
# or
|
||||||
|
type=raw,foo
|
||||||
|
type=raw,bar
|
||||||
|
# or
|
||||||
|
foo
|
||||||
|
bar
|
||||||
|
```
|
||||||
|
|
||||||
|
Output custom tags according to your needs.
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=raw,enable=true,priority=200,prefix=,suffix=,value=
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=sha`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=sha
|
||||||
|
```
|
||||||
|
|
||||||
|
Output Git short commit as Docker tag like `sha-ad132f5`.
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=sha,enable=true,priority=100,prefix=sha-,suffix=
|
||||||
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### `tag-match` examples
|
### Latest tag
|
||||||
|
|
||||||
| Git tag | `tag-match` | `tag-match-group` | Docker tag
|
`latest` tag is handled through the [`flavor` input](#flavor-input). It will be generated by default (`auto` mode) for:
|
||||||
|-------------------------|------------------------------------|-------------------|------------------|
|
* [`type=ref,event=tag`](#typeref)
|
||||||
| `v1.2.3` | `\\d{1,3}.\\d{1,3}.\\d{1,3}` | `0` | `1.2.3` |
|
* [`type=semver,pattern=...`](#typesemver)
|
||||||
| `v2.0.8-beta.67` | `v(.*)` | `1` | `2.0.8-beta.67` |
|
* [`type=match,pattern=...`](#typematch)
|
||||||
| `v2.0.8-beta.67` | `v(\\d.\\d)` | `1` | `2.0` |
|
|
||||||
| `release1` | `\\d{1,3}.\\d{1,3}` | `0` | `release1` |
|
|
||||||
| `20200110-RC2` | `\\d+` | `0` | `20200110` |
|
|
||||||
|
|
||||||
### Schedule tag
|
### Global expressions
|
||||||
|
|
||||||
`tag-schedule` is specially crafted input to support [Handlebars template](https://handlebarsjs.com/guide/) with
|
The following [Handlebars template](https://handlebarsjs.com/guide/) expressions for `prefix`, `suffix` and `value`
|
||||||
the following expressions:
|
attributes are available:
|
||||||
|
|
||||||
| Expression | Example | Description |
|
| Expression | Output |
|
||||||
|-------------------------|-------------------------------------------|------------------------------------------|
|
|--------------------------|----------------------|
|
||||||
| `{{date 'format'}}` | `{{date 'YYYYMMDD'}}` > `20200110` | Render date by its [moment format](https://momentjs.com/docs/#/displaying/format/)
|
| `{{branch}}` | `master` |
|
||||||
|
| `{{tag}}` | `v1.2.3` |
|
||||||
|
| `{{sha}}` | `90dd603` |
|
||||||
|
|
||||||
You can find more examples in the [CI workflow](.github/workflows/ci.yml).
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# dynamically set the branch name as a prefix
|
||||||
|
type=sha,prefix={{branch}}-
|
||||||
|
# dynamically set the branch name and sha as a custom tag
|
||||||
|
type=raw,value=mytag-{{branch}}-{{sha}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Major version zero
|
||||||
|
|
||||||
|
Major version zero (`0.y.z`) is for initial development and **may** change at any time. This means the public API
|
||||||
|
[**should not** be considered stable](https://semver.org/#spec-item-4).
|
||||||
|
|
||||||
|
In this case, Docker tag `0` **should not** be generated if you're using [`type=semver`](#typesemver) with `{{major}}`
|
||||||
|
pattern. You can manage this behavior like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# refs/tags/v0.1.2
|
||||||
|
tags: |
|
||||||
|
# output 0.1.2
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
# output 0.1
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
# disabled if major zero
|
||||||
|
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 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: Docker meta
|
||||||
|
id: docker_meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
labels: |
|
||||||
|
maintainer=CrazyMax
|
||||||
|
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
|
||||||
|
|
||||||
@@ -172,16 +618,3 @@ updates:
|
|||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
```
|
```
|
||||||
|
|
||||||
## How can I help?
|
|
||||||
|
|
||||||
All kinds of contributions are welcome :raised_hands:! The most basic way to show your support is to star :star2:
|
|
||||||
the project, or to raise issues :speech_balloon: You can also support this project by
|
|
||||||
[**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) :clap: or by making a
|
|
||||||
[Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely! :rocket:
|
|
||||||
|
|
||||||
Thanks again for your support, it is much appreciated! :pray:
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT. See `LICENSE` for more details.
|
|
||||||
|
299
UPGRADE.md
Normal file
299
UPGRADE.md
Normal file
@@ -0,0 +1,299 @@
|
|||||||
|
# Upgrade notes
|
||||||
|
|
||||||
|
## v2 to v3
|
||||||
|
|
||||||
|
* Repository has been moved to docker org. Replace `crazy-max/ghaction-docker-meta@v2` with `docker/metadata-action@v3`
|
||||||
|
* The default bake target has been changed: `ghaction-docker-meta` > `docker-metadata-action`
|
||||||
|
|
||||||
|
## v1 to v2
|
||||||
|
|
||||||
|
* [inputs](#inputs)
|
||||||
|
* [`tag-sha`](#tag-sha)
|
||||||
|
* [`tag-edge` / `tag-edge-branch`](#tag-edge--tag-edge-branch)
|
||||||
|
* [`tag-semver`](#tag-semver)
|
||||||
|
* [`tag-match` / `tag-match-group`](#tag-match--tag-match-group)
|
||||||
|
* [`tag-latest`](#tag-latest)
|
||||||
|
* [`tag-schedule`](#tag-schedule)
|
||||||
|
* [`tag-custom` / `tag-custom-only`](#tag-custom--tag-custom-only)
|
||||||
|
* [`label-custom`](#label-custom)
|
||||||
|
* [Basic workflow](#basic-workflow)
|
||||||
|
* [Semver workflow](#semver-workflow)
|
||||||
|
|
||||||
|
### inputs
|
||||||
|
|
||||||
|
| New | Unchanged | Removed |
|
||||||
|
|------------|-----------------|--------------------|
|
||||||
|
| `tags` | `images` | `tag-sha` |
|
||||||
|
| `flavor` | `sep-tags` | `tag-edge` |
|
||||||
|
| `labels` | `sep-labels` | `tag-edge-branch` |
|
||||||
|
| | | `tag-semver` |
|
||||||
|
| | | `tag-match` |
|
||||||
|
| | | `tag-match-group` |
|
||||||
|
| | | `tag-latest` |
|
||||||
|
| | | `tag-schedule` |
|
||||||
|
| | | `tag-custom` |
|
||||||
|
| | | `tag-custom-only` |
|
||||||
|
| | | `label-custom` |
|
||||||
|
|
||||||
|
#### `tag-sha`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=sha
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-edge` / `tag-edge-branch`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# default branch
|
||||||
|
type=edge
|
||||||
|
# specify branch
|
||||||
|
type=edge,branch=main
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-semver`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-match` / `tag-match-group`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=match,pattern=v(.*),group=1
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-latest`
|
||||||
|
|
||||||
|
`tag-latest` is now handled through the [`flavor` input](README.md#flavor-input):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
flavor: |
|
||||||
|
latest=auto
|
||||||
|
```
|
||||||
|
|
||||||
|
See also the notes about ["latest tag" behavior](README.md#latest-tag)
|
||||||
|
|
||||||
|
#### `tag-schedule`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# default tag (nightly)
|
||||||
|
type=schedule
|
||||||
|
# specific pattern
|
||||||
|
type=schedule,pattern={{date 'YYYYMMDD'}}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-custom` / `tag-custom-only`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=raw,value=foo
|
||||||
|
type=raw,value=bar
|
||||||
|
# or
|
||||||
|
type=raw,foo
|
||||||
|
type=raw,bar
|
||||||
|
# or
|
||||||
|
foo
|
||||||
|
bar
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `label-custom`
|
||||||
|
|
||||||
|
Same behavior for `labels`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
labels: |
|
||||||
|
maintainer=CrazyMax
|
||||||
|
```
|
||||||
|
|
||||||
|
### Basic workflow
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# v1
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v1
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# v2
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Semver workflow
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# v1
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v1
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
tag-semver: |
|
||||||
|
{{version}}
|
||||||
|
{{major}}.{{minor}}
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# v2
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
@@ -1,54 +1,162 @@
|
|||||||
|
import * as fs from 'fs';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
import * as context from '../src/context';
|
import * as context from '../src/context';
|
||||||
|
|
||||||
|
jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
|
||||||
|
const tmpDir = path.join('/tmp/.docker-metadata-action-jest').split(path.sep).join(path.posix.sep);
|
||||||
|
if (!fs.existsSync(tmpDir)) {
|
||||||
|
fs.mkdirSync(tmpDir, {recursive: true});
|
||||||
|
}
|
||||||
|
return tmpDir;
|
||||||
|
});
|
||||||
|
|
||||||
describe('getInputList', () => {
|
describe('getInputList', () => {
|
||||||
it('handles single line correctly', async () => {
|
it('single line correctly', async () => {
|
||||||
await setInput('foo', 'bar');
|
await setInput('foo', 'bar');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar']);
|
expect(res).toEqual(['bar']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles multiple lines correctly', async () => {
|
it('multiline correctly', async () => {
|
||||||
setInput('foo', 'bar\nbaz');
|
setInput('foo', 'bar\nbaz');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('remove empty lines correctly', async () => {
|
it('empty lines correctly', async () => {
|
||||||
setInput('foo', 'bar\n\nbaz');
|
setInput('foo', 'bar\n\nbaz');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles comma correctly', async () => {
|
it('comma correctly', async () => {
|
||||||
setInput('foo', 'bar,baz');
|
setInput('foo', 'bar,baz');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('remove empty result correctly', async () => {
|
it('empty result correctly', async () => {
|
||||||
setInput('foo', 'bar,baz,');
|
setInput('foo', 'bar,baz,');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles different new lines correctly', async () => {
|
it('different new lines correctly', async () => {
|
||||||
setInput('foo', 'bar\r\nbaz');
|
setInput('foo', 'bar\r\nbaz');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles different new lines and comma correctly', async () => {
|
it('different new lines and comma correctly', async () => {
|
||||||
setInput('foo', 'bar\r\nbaz,bat');
|
setInput('foo', 'bar\r\nbaz,bat');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz', 'bat']);
|
expect(res).toEqual(['bar', 'baz', 'bat']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('multiline and ignoring comma correctly', async () => {
|
||||||
|
setInput('cache-from', 'user/app:cache\ntype=local,src=path/to/dir');
|
||||||
|
const res = await context.getInputList('cache-from', true);
|
||||||
|
console.log(res);
|
||||||
|
expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('different new lines and ignoring comma correctly', async () => {
|
||||||
|
setInput('cache-from', 'user/app:cache\r\ntype=local,src=path/to/dir');
|
||||||
|
const res = await context.getInputList('cache-from', true);
|
||||||
|
console.log(res);
|
||||||
|
expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('multiline values', async () => {
|
||||||
|
setInput(
|
||||||
|
'secrets',
|
||||||
|
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
||||||
|
"MYSECRET=aaaaaaaa
|
||||||
|
bbbbbbb
|
||||||
|
ccccccccc"
|
||||||
|
FOO=bar`
|
||||||
|
);
|
||||||
|
const res = await context.getInputList('secrets', true);
|
||||||
|
console.log(res);
|
||||||
|
expect(res).toEqual([
|
||||||
|
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
|
||||||
|
`MYSECRET=aaaaaaaa
|
||||||
|
bbbbbbb
|
||||||
|
ccccccccc`,
|
||||||
|
'FOO=bar'
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('multiline values with empty lines', async () => {
|
||||||
|
setInput(
|
||||||
|
'secrets',
|
||||||
|
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
||||||
|
"MYSECRET=aaaaaaaa
|
||||||
|
bbbbbbb
|
||||||
|
ccccccccc"
|
||||||
|
FOO=bar
|
||||||
|
"EMPTYLINE=aaaa
|
||||||
|
|
||||||
|
bbbb
|
||||||
|
ccc"`
|
||||||
|
);
|
||||||
|
const res = await context.getInputList('secrets', true);
|
||||||
|
console.log(res);
|
||||||
|
expect(res).toEqual([
|
||||||
|
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
|
||||||
|
`MYSECRET=aaaaaaaa
|
||||||
|
bbbbbbb
|
||||||
|
ccccccccc`,
|
||||||
|
'FOO=bar',
|
||||||
|
`EMPTYLINE=aaaa
|
||||||
|
|
||||||
|
bbbb
|
||||||
|
ccc`
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('multiline values without quotes', async () => {
|
||||||
|
setInput(
|
||||||
|
'secrets',
|
||||||
|
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
||||||
|
MYSECRET=aaaaaaaa
|
||||||
|
bbbbbbb
|
||||||
|
ccccccccc
|
||||||
|
FOO=bar`
|
||||||
|
);
|
||||||
|
const res = await context.getInputList('secrets', true);
|
||||||
|
console.log(res);
|
||||||
|
expect(res).toEqual(['GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789', 'MYSECRET=aaaaaaaa', 'bbbbbbb', 'ccccccccc', 'FOO=bar']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('multiline values escape quotes', async () => {
|
||||||
|
setInput(
|
||||||
|
'secrets',
|
||||||
|
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
||||||
|
"MYSECRET=aaaaaaaa
|
||||||
|
bbbb""bbb
|
||||||
|
ccccccccc"
|
||||||
|
FOO=bar`
|
||||||
|
);
|
||||||
|
const res = await context.getInputList('secrets', true);
|
||||||
|
console.log(res);
|
||||||
|
expect(res).toEqual([
|
||||||
|
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
|
||||||
|
`MYSECRET=aaaaaaaa
|
||||||
|
bbbb\"bbb
|
||||||
|
ccccccccc`,
|
||||||
|
'FOO=bar'
|
||||||
|
]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('asyncForEach', () => {
|
describe('asyncForEach', () => {
|
||||||
@@ -64,6 +172,27 @@ describe('asyncForEach', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('setOutput', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
process.stdout.write = jest.fn();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('setOutput produces the correct command', () => {
|
||||||
|
context.setOutput('some output', 'some value');
|
||||||
|
assertWriteCalls([`::set-output name=some output::some value${os.EOL}`]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('setOutput handles bools', () => {
|
||||||
|
context.setOutput('some output', false);
|
||||||
|
assertWriteCalls([`::set-output name=some output::false${os.EOL}`]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('setOutput handles numbers', () => {
|
||||||
|
context.setOutput('some output', 1.01);
|
||||||
|
assertWriteCalls([`::set-output name=some output::1.01${os.EOL}`]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67
|
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67
|
||||||
function getInputName(name: string): string {
|
function getInputName(name: string): string {
|
||||||
return `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
return `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
||||||
@@ -72,3 +201,11 @@ function getInputName(name: string): string {
|
|||||||
function setInput(name: string, value: string): void {
|
function setInput(name: string, value: string): void {
|
||||||
process.env[getInputName(name)] = value;
|
process.env[getInputName(name)] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assert that process.stdout.write calls called only with the given arguments.
|
||||||
|
function assertWriteCalls(calls: string[]): void {
|
||||||
|
expect(process.stdout.write).toHaveBeenCalledTimes(calls.length);
|
||||||
|
for (let i = 0; i < calls.length; i++) {
|
||||||
|
expect(process.stdout.write).toHaveBeenNthCalledWith(i + 1, calls[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
23
__tests__/fixtures/event_push_invalidchars.env
Normal file
23
__tests__/fixtures/event_push_invalidchars.env
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||||
|
GITHUB_ACTIONS=true
|
||||||
|
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||||
|
GITHUB_ACTOR=crazy-max
|
||||||
|
GITHUB_API_URL=https://api.github.com
|
||||||
|
GITHUB_BASE_REF=
|
||||||
|
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_89a016e8-e5b7-4039-a67e-c8da08f87a0c
|
||||||
|
GITHUB_EVENT_NAME=push
|
||||||
|
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||||
|
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||||
|
GITHUB_HEAD_REF=
|
||||||
|
GITHUB_JOB=event
|
||||||
|
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_89a016e8-e5b7-4039-a67e-c8da08f87a0c
|
||||||
|
GITHUB_REF="refs/heads/my/feature#1245"
|
||||||
|
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||||
|
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||||
|
GITHUB_RETENTION_DAYS=90
|
||||||
|
GITHUB_RUN_ID=325957516
|
||||||
|
GITHUB_RUN_NUMBER=1
|
||||||
|
GITHUB_SERVER_URL=https://github.com
|
||||||
|
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||||
|
GITHUB_WORKFLOW=event
|
||||||
|
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
23
__tests__/fixtures/event_tag_p1-v1.0.0.env
Normal file
23
__tests__/fixtures/event_tag_p1-v1.0.0.env
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||||
|
GITHUB_ACTIONS=true
|
||||||
|
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||||
|
GITHUB_ACTOR=crazy-max
|
||||||
|
GITHUB_API_URL=https://api.github.com
|
||||||
|
GITHUB_BASE_REF=
|
||||||
|
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
GITHUB_EVENT_NAME=push
|
||||||
|
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||||
|
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||||
|
GITHUB_HEAD_REF=
|
||||||
|
GITHUB_JOB=event
|
||||||
|
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
GITHUB_REF=refs/tags/p1/v1.0.0
|
||||||
|
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||||
|
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||||
|
GITHUB_RETENTION_DAYS=90
|
||||||
|
GITHUB_RUN_ID=325968230
|
||||||
|
GITHUB_RUN_NUMBER=4
|
||||||
|
GITHUB_SERVER_URL=https://github.com
|
||||||
|
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||||
|
GITHUB_WORKFLOW=event
|
||||||
|
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
115
__tests__/flavor.test.ts
Normal file
115
__tests__/flavor.test.ts
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
import {Flavor, Transform} from '../src/flavor';
|
||||||
|
|
||||||
|
describe('transform', () => {
|
||||||
|
// prettier-ignore
|
||||||
|
test.each([
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`randomstr`,
|
||||||
|
`latest=auto`
|
||||||
|
],
|
||||||
|
{} as Flavor,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`unknwown=foo`
|
||||||
|
],
|
||||||
|
{} as Flavor,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`latest`,
|
||||||
|
],
|
||||||
|
{} as Flavor,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`latest=true`
|
||||||
|
],
|
||||||
|
{
|
||||||
|
latest: "true",
|
||||||
|
prefix: "",
|
||||||
|
suffix: ""
|
||||||
|
} as Flavor,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`latest=false`
|
||||||
|
],
|
||||||
|
{
|
||||||
|
latest: "false",
|
||||||
|
prefix: "",
|
||||||
|
suffix: ""
|
||||||
|
} as Flavor,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`latest=auto`
|
||||||
|
],
|
||||||
|
{
|
||||||
|
latest: "auto",
|
||||||
|
prefix: "",
|
||||||
|
suffix: ""
|
||||||
|
} as Flavor,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`latest=foo`
|
||||||
|
],
|
||||||
|
{} as Flavor,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`prefix=sha-`
|
||||||
|
],
|
||||||
|
{
|
||||||
|
latest: "auto",
|
||||||
|
prefix: "sha-",
|
||||||
|
suffix: ""
|
||||||
|
} as Flavor,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`suffix=-alpine`
|
||||||
|
],
|
||||||
|
{
|
||||||
|
latest: "auto",
|
||||||
|
prefix: "",
|
||||||
|
suffix: "-alpine"
|
||||||
|
} as Flavor,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`latest=false`,
|
||||||
|
`prefix=dev-`,
|
||||||
|
`suffix=-alpine`
|
||||||
|
],
|
||||||
|
{
|
||||||
|
latest: "false",
|
||||||
|
prefix: "dev-",
|
||||||
|
suffix: "-alpine"
|
||||||
|
} as Flavor,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
])('given %p attributes ', async (inputs: string[], expected: Flavor, invalid: boolean) => {
|
||||||
|
try {
|
||||||
|
const flavor = Transform(inputs);
|
||||||
|
console.log(flavor);
|
||||||
|
expect(flavor).toEqual(expected);
|
||||||
|
} catch (err) {
|
||||||
|
if (!invalid) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
expect(true).toBe(invalid);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
File diff suppressed because it is too large
Load Diff
419
__tests__/tag.test.ts
Normal file
419
__tests__/tag.test.ts
Normal file
@@ -0,0 +1,419 @@
|
|||||||
|
import {Transform, Parse, Tag, Type, RefEvent, DefaultPriorities} from '../src/tag';
|
||||||
|
|
||||||
|
describe('transform', () => {
|
||||||
|
// prettier-ignore
|
||||||
|
test.each([
|
||||||
|
[
|
||||||
|
[
|
||||||
|
`type=ref,event=branch`,
|
||||||
|
`type=ref,event=tag`,
|
||||||
|
`type=ref,event=pr`,
|
||||||
|
`type=schedule`,
|
||||||
|
`type=sha`,
|
||||||
|
`type=raw,foo`,
|
||||||
|
`type=edge`,
|
||||||
|
`type=semver,pattern={{version}}`,
|
||||||
|
`type=match,"pattern=\\d.\\d.\\d",group=0`
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: Type.Schedule,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Schedule],
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "nightly"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: Type.Semver,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Semver],
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "{{version}}",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: Type.Match,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Match],
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "\\d.\\d.\\d",
|
||||||
|
"group": "0",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: Type.Edge,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Edge],
|
||||||
|
"enable": "true",
|
||||||
|
"branch": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: Type.Ref,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
|
"enable": "true",
|
||||||
|
"event": RefEvent.Branch
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: Type.Ref,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
|
"enable": "true",
|
||||||
|
"event": RefEvent.Tag
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: Type.Ref,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
|
"enable": "true",
|
||||||
|
"prefix": "pr-",
|
||||||
|
"event": RefEvent.PR
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: Type.Raw,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
|
"enable": "true",
|
||||||
|
"value": "foo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: Type.Sha,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Sha],
|
||||||
|
"enable": "true",
|
||||||
|
"prefix": "sha-"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
] as Tag[],
|
||||||
|
false
|
||||||
|
]
|
||||||
|
])('given %p', async (l: string[], expected: Tag[], invalid: boolean) => {
|
||||||
|
try {
|
||||||
|
const tags = Transform(l);
|
||||||
|
console.log(tags);
|
||||||
|
expect(tags).toEqual(expected);
|
||||||
|
} catch (err) {
|
||||||
|
if (!invalid) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
expect(true).toBe(invalid);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('parse', () => {
|
||||||
|
// prettier-ignore
|
||||||
|
test.each([
|
||||||
|
[
|
||||||
|
`type=schedule,enable=true,pattern={{date 'YYYYMMDD'}}`,
|
||||||
|
{
|
||||||
|
type: Type.Schedule,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Schedule],
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "{{date 'YYYYMMDD'}}"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=semver,enable=true,pattern={{version}}`,
|
||||||
|
{
|
||||||
|
type: Type.Semver,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Semver],
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "{{version}}",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=semver,priority=1,enable=true,pattern={{version}}`,
|
||||||
|
{
|
||||||
|
type: Type.Semver,
|
||||||
|
attrs: {
|
||||||
|
"priority": "1",
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "{{version}}",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=semver,priority=1,enable=true,pattern={{version}},value=v1.0.0`,
|
||||||
|
{
|
||||||
|
type: Type.Semver,
|
||||||
|
attrs: {
|
||||||
|
"priority": "1",
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "{{version}}",
|
||||||
|
"value": "v1.0.0"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=match,enable=true,pattern=v(.*),group=1`,
|
||||||
|
{
|
||||||
|
type: Type.Match,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Match],
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "v(.*)",
|
||||||
|
"group": "1",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=match,enable=true,"pattern=^v(\\d.\\d.\\d)$",group=1`,
|
||||||
|
{
|
||||||
|
type: Type.Match,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Match],
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "^v(\\d.\\d.\\d)$",
|
||||||
|
"group": "1",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=match,priority=700,enable=true,pattern=v(.*),group=1`,
|
||||||
|
{
|
||||||
|
type: Type.Match,
|
||||||
|
attrs: {
|
||||||
|
"priority": "700",
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "v(.*)",
|
||||||
|
"group": "1",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=match,enable=true,pattern=v(.*),group=1,value=v1.2.3`,
|
||||||
|
{
|
||||||
|
type: Type.Match,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Match],
|
||||||
|
"enable": "true",
|
||||||
|
"pattern": "v(.*)",
|
||||||
|
"group": "1",
|
||||||
|
"value": "v1.2.3"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=match,enable=true,pattern=v(.*),group=foo`,
|
||||||
|
{} as Tag,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=edge`,
|
||||||
|
{
|
||||||
|
type: Type.Edge,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Edge],
|
||||||
|
"enable": "true",
|
||||||
|
"branch": ""
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=edge,enable=true,branch=master`,
|
||||||
|
{
|
||||||
|
type: Type.Edge,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Edge],
|
||||||
|
"enable": "true",
|
||||||
|
"branch": "master"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=ref,event=tag`,
|
||||||
|
{
|
||||||
|
type: Type.Ref,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
|
"enable": "true",
|
||||||
|
"event": RefEvent.Tag
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=ref,event=branch`,
|
||||||
|
{
|
||||||
|
type: Type.Ref,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
|
"enable": "true",
|
||||||
|
"event": RefEvent.Branch
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=ref,event=pr`,
|
||||||
|
{
|
||||||
|
type: Type.Ref,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
|
"enable": "true",
|
||||||
|
"prefix": "pr-",
|
||||||
|
"event": RefEvent.PR
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=ref,event=foo`,
|
||||||
|
{} as Tag,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=ref`,
|
||||||
|
{} as Tag,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`acustomtag`,
|
||||||
|
{
|
||||||
|
type: Type.Raw,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
|
"enable": "true",
|
||||||
|
"value": "acustomtag"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=raw`,
|
||||||
|
{} as Tag,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=raw,value=acustomtag2`,
|
||||||
|
{
|
||||||
|
type: Type.Raw,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
|
"enable": "true",
|
||||||
|
"value": "acustomtag2"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=raw,enable=true,value=acustomtag4`,
|
||||||
|
{
|
||||||
|
type: Type.Raw,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
|
"enable": "true",
|
||||||
|
"value": "acustomtag4"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=raw,enable=false,value=acustomtag5`,
|
||||||
|
{
|
||||||
|
type: Type.Raw,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
|
"enable": "false",
|
||||||
|
"value": "acustomtag5"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=sha`,
|
||||||
|
{
|
||||||
|
type: Type.Sha,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Sha],
|
||||||
|
"enable": "true",
|
||||||
|
"prefix": "sha-"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=sha,prefix=`,
|
||||||
|
{
|
||||||
|
type: Type.Sha,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Sha],
|
||||||
|
"enable": "true",
|
||||||
|
"prefix": ""
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=sha,enable=false`,
|
||||||
|
{
|
||||||
|
type: Type.Sha,
|
||||||
|
attrs: {
|
||||||
|
"priority": DefaultPriorities[Type.Sha],
|
||||||
|
"enable": "false",
|
||||||
|
"prefix": "sha-"
|
||||||
|
}
|
||||||
|
} as Tag,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=semver`,
|
||||||
|
{} as Tag,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=match`,
|
||||||
|
{} as Tag,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=foo`,
|
||||||
|
{} as Tag,
|
||||||
|
true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
`type=sha,enable=foo`,
|
||||||
|
{} as Tag,
|
||||||
|
true
|
||||||
|
]
|
||||||
|
])('given %p event ', async (s: string, expected: Tag, invalid: boolean) => {
|
||||||
|
try {
|
||||||
|
const tag = Parse(s);
|
||||||
|
console.log(tag);
|
||||||
|
expect(tag).toEqual(expected);
|
||||||
|
} catch (err) {
|
||||||
|
if (!invalid) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
expect(true).toBe(invalid);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
40
action.yml
40
action.yml
@@ -1,40 +1,23 @@
|
|||||||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
||||||
name: 'Docker Meta'
|
name: 'Docker Metadata action'
|
||||||
description: "GitHub Action to extract metadata (tags, labels) for Docker"
|
description: "GitHub Action to extract metadata (tags, labels) for Docker"
|
||||||
author: 'crazy-max'
|
author: 'docker'
|
||||||
branding:
|
branding:
|
||||||
|
icon: 'anchor'
|
||||||
color: 'blue'
|
color: 'blue'
|
||||||
icon: 'layers'
|
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
images:
|
images:
|
||||||
description: 'List of Docker images to use as base name for tags'
|
description: 'List of Docker images to use as base name for tags'
|
||||||
required: true
|
required: true
|
||||||
tag-sha:
|
tags:
|
||||||
description: 'Add git short SHA as Docker tag'
|
description: 'List of tags as key-value pair attributes'
|
||||||
default: 'false'
|
|
||||||
required: false
|
required: false
|
||||||
tag-edge:
|
flavor:
|
||||||
description: 'Enable edge branch tagging'
|
description: 'Flavors to apply'
|
||||||
default: 'false'
|
|
||||||
required: false
|
required: false
|
||||||
tag-edge-branch:
|
labels:
|
||||||
description: 'Branch that will be tagged as edge (default repo.default_branch)'
|
description: 'List of custom labels'
|
||||||
required: false
|
|
||||||
tag-match:
|
|
||||||
description: 'RegExp to match against a Git tag and use match group as Docker tag'
|
|
||||||
required: false
|
|
||||||
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'
|
|
||||||
default: 'true'
|
|
||||||
required: false
|
|
||||||
tag-schedule:
|
|
||||||
description: 'Template to apply to schedule tag'
|
|
||||||
default: 'nightly'
|
|
||||||
required: false
|
required: false
|
||||||
sep-tags:
|
sep-tags:
|
||||||
description: 'Separator to use for tags output (default \n)'
|
description: 'Separator to use for tags output (default \n)'
|
||||||
@@ -42,6 +25,9 @@ inputs:
|
|||||||
sep-labels:
|
sep-labels:
|
||||||
description: 'Separator to use for labels output (default \n)'
|
description: 'Separator to use for labels output (default \n)'
|
||||||
required: false
|
required: false
|
||||||
|
bake-target:
|
||||||
|
description: 'Bake target name (default docker-metadata-action)'
|
||||||
|
required: false
|
||||||
github-token:
|
github-token:
|
||||||
description: 'GitHub Token as provided by secrets'
|
description: 'GitHub Token as provided by secrets'
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
@@ -54,6 +40,8 @@ outputs:
|
|||||||
description: 'Generated Docker tags'
|
description: 'Generated Docker tags'
|
||||||
labels:
|
labels:
|
||||||
description: 'Generated Docker labels'
|
description: 'Generated Docker labels'
|
||||||
|
bake-file:
|
||||||
|
description: 'Bake definiton file'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
|
5216
dist/index.js
generated
vendored
5216
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
@@ -1,42 +1,67 @@
|
|||||||
|
variable "NODE_VERSION" {
|
||||||
|
default = "12"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "node-version" {
|
||||||
|
args = {
|
||||||
|
NODE_VERSION = NODE_VERSION
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
group "default" {
|
group "default" {
|
||||||
targets = ["build"]
|
targets = ["build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
group "pre-checkin" {
|
group "pre-checkin" {
|
||||||
targets = ["update-yarn", "format", "build"]
|
targets = ["vendor-update", "format", "build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
group "validate" {
|
group "validate" {
|
||||||
targets = ["validate-format", "validate-build", "validate-yarn"]
|
targets = ["format-validate", "build-validate", "vendor-validate"]
|
||||||
}
|
|
||||||
|
|
||||||
target "update-yarn" {
|
|
||||||
target = "update-yarn"
|
|
||||||
output = ["."]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build" {
|
target "build" {
|
||||||
target = "dist"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "build-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "test" {
|
target "build-validate" {
|
||||||
target = "test"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "build-validate"
|
||||||
}
|
}
|
||||||
|
|
||||||
target "format" {
|
target "format" {
|
||||||
target = "format"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "format-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-format" {
|
target "format-validate" {
|
||||||
target = "validate-format"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "format-validate"
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-build" {
|
target "vendor-update" {
|
||||||
target = "validate-build"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/vendor.Dockerfile"
|
||||||
|
target = "update"
|
||||||
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-yarn" {
|
target "vendor-validate" {
|
||||||
target = "validate-yarn"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/vendor.Dockerfile"
|
||||||
|
target = "validate"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "test" {
|
||||||
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/test.Dockerfile"
|
||||||
|
target = "test-coverage"
|
||||||
|
output = ["./coverage"]
|
||||||
}
|
}
|
||||||
|
42
hack/build.Dockerfile
Normal file
42
hack/build.Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# syntax=docker/dockerfile:1.2
|
||||||
|
ARG NODE_VERSION
|
||||||
|
|
||||||
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
|
RUN apk add --no-cache cpio findutils git
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
FROM base AS deps
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
FROM deps AS build
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run build && mkdir /out && cp -Rf dist /out/
|
||||||
|
|
||||||
|
FROM scratch AS build-update
|
||||||
|
COPY --from=build /out /
|
||||||
|
|
||||||
|
FROM build AS build-validate
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
git add -A && cp -rf /out/* .; \
|
||||||
|
if [ -n "$(git status --porcelain -- dist)" ]; then \
|
||||||
|
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'; \
|
||||||
|
git status --porcelain -- dist; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
FROM deps AS format
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run format \
|
||||||
|
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
|
||||||
|
|
||||||
|
FROM scratch AS format-update
|
||||||
|
COPY --from=format /out /
|
||||||
|
|
||||||
|
FROM deps AS format-validate
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run format-check \
|
21
hack/test.Dockerfile
Normal file
21
hack/test.Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# syntax=docker/dockerfile:1.2
|
||||||
|
ARG NODE_VERSION
|
||||||
|
|
||||||
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
FROM base AS deps
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
FROM deps AS test
|
||||||
|
ENV RUNNER_TEMP=/tmp/github_runner
|
||||||
|
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run test --coverageDirectory=/tmp/coverage
|
||||||
|
|
||||||
|
FROM scratch AS test-coverage
|
||||||
|
COPY --from=test /tmp/coverage /
|
23
hack/vendor.Dockerfile
Normal file
23
hack/vendor.Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# syntax=docker/dockerfile:1.2
|
||||||
|
ARG NODE_VERSION
|
||||||
|
|
||||||
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
FROM base AS vendored
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn install && mkdir /out && cp yarn.lock /out
|
||||||
|
|
||||||
|
FROM scratch AS update
|
||||||
|
COPY --from=vendored /out /
|
||||||
|
|
||||||
|
FROM vendored AS validate
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
git add -A && cp -rf /out/* .; \
|
||||||
|
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then \
|
||||||
|
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'; \
|
||||||
|
git status --porcelain -- yarn.lock; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
24
package.json
24
package.json
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "docker-meta",
|
"name": "docker-metadata-action",
|
||||||
"description": "GitHub Action to extract metadata (tags, labels) for Docker",
|
"description": "GitHub Action to extract metadata (tags, labels) for Docker",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -11,22 +11,30 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/crazy-max/ghaction-docker-meta.git"
|
"url": "git+https://github.com/docker/metadata-action.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
"docker",
|
"docker",
|
||||||
"meta",
|
"metadata",
|
||||||
"tag",
|
"tag",
|
||||||
"label"
|
"label"
|
||||||
],
|
],
|
||||||
"author": "CrazyMax",
|
"author": "Docker",
|
||||||
"license": "MIT",
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"url": "https://crazymax.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.7",
|
||||||
"@actions/github": "^4.0.0",
|
"@actions/github": "^4.0.0",
|
||||||
"handlebars": "^4.7.6",
|
"csv-parse": "^4.15.4",
|
||||||
"moment": "^2.29.1"
|
"handlebars": "^4.7.7",
|
||||||
|
"moment": "^2.29.1",
|
||||||
|
"semver": "^7.3.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.0",
|
"@types/jest": "^26.0.0",
|
||||||
|
@@ -1,44 +1,67 @@
|
|||||||
|
import csvparse from 'csv-parse/lib/sync';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
import {issueCommand} from '@actions/core/lib/command';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
let _tmpDir: string;
|
||||||
|
|
||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
images: string[];
|
images: string[];
|
||||||
tagSha: boolean;
|
tags: string[];
|
||||||
tagEdge: boolean;
|
flavor: string[];
|
||||||
tagEdgeBranch: string;
|
labels: string[];
|
||||||
tagMatch: string;
|
|
||||||
tagMatchGroup: number;
|
|
||||||
tagMatchLatest: boolean;
|
|
||||||
tagSchedule: string;
|
|
||||||
sepTags: string;
|
sepTags: string;
|
||||||
sepLabels: string;
|
sepLabels: string;
|
||||||
|
bakeTarget: string;
|
||||||
githubToken: string;
|
githubToken: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function tmpDir(): string {
|
||||||
|
if (!_tmpDir) {
|
||||||
|
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-')).split(path.sep).join(path.posix.sep);
|
||||||
|
}
|
||||||
|
return _tmpDir;
|
||||||
|
}
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
export function getInputs(): Inputs {
|
||||||
return {
|
return {
|
||||||
images: getInputList('images'),
|
images: getInputList('images'),
|
||||||
tagSha: /true/i.test(core.getInput('tag-sha') || 'false'),
|
tags: getInputList('tags', true),
|
||||||
tagEdge: /true/i.test(core.getInput('tag-edge') || 'false'),
|
flavor: getInputList('flavor', true),
|
||||||
tagEdgeBranch: core.getInput('tag-edge-branch'),
|
labels: getInputList('labels', true),
|
||||||
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`,
|
sepTags: core.getInput('sep-tags') || `\n`,
|
||||||
sepLabels: core.getInput('sep-labels') || `\n`,
|
sepLabels: core.getInput('sep-labels') || `\n`,
|
||||||
|
bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,
|
||||||
githubToken: core.getInput('github-token')
|
githubToken: core.getInput('github-token')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputList(name: string): string[] {
|
export function getInputList(name: string, ignoreComma?: boolean): string[] {
|
||||||
|
let res: Array<string> = [];
|
||||||
|
|
||||||
const items = core.getInput(name);
|
const items = core.getInput(name);
|
||||||
if (items == '') {
|
if (items == '') {
|
||||||
return [];
|
return res;
|
||||||
}
|
}
|
||||||
return items
|
|
||||||
.split(/\r?\n/)
|
for (let output of csvparse(items, {
|
||||||
.filter(x => x)
|
columns: false,
|
||||||
.reduce<string[]>((acc, line) => acc.concat(line.split(',').filter(x => x)).map(pat => pat.trim()), []);
|
relaxColumnCount: true,
|
||||||
|
skipLinesWithEmptyValues: true
|
||||||
|
}) as Array<string[]>) {
|
||||||
|
if (output.length == 1) {
|
||||||
|
res.push(output[0]);
|
||||||
|
continue;
|
||||||
|
} else if (!ignoreComma) {
|
||||||
|
res.push(...output);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
res.push(output.join(','));
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.filter(item => item).map(pat => pat.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
export const asyncForEach = async (array, callback) => {
|
export const asyncForEach = async (array, callback) => {
|
||||||
@@ -46,3 +69,8 @@ export const asyncForEach = async (array, callback) => {
|
|||||||
await callback(array[index], index, array);
|
await callback(array[index], index, array);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
|
||||||
|
export function setOutput(name: string, value: any): void {
|
||||||
|
issueCommand('set-output', {name}, value);
|
||||||
|
}
|
||||||
|
50
src/flavor.ts
Normal file
50
src/flavor.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
export interface Flavor {
|
||||||
|
latest: string;
|
||||||
|
prefix: string;
|
||||||
|
suffix: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Transform(inputs: string[]): Flavor {
|
||||||
|
const flavor: Flavor = {
|
||||||
|
latest: 'auto',
|
||||||
|
prefix: '',
|
||||||
|
suffix: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const input of inputs) {
|
||||||
|
const parts = input.split('=', 2);
|
||||||
|
if (parts.length == 1) {
|
||||||
|
throw new Error(`Invalid entry: ${input}`);
|
||||||
|
}
|
||||||
|
switch (parts[0]) {
|
||||||
|
case 'latest': {
|
||||||
|
flavor.latest = parts[1];
|
||||||
|
if (!['auto', 'true', 'false'].includes(flavor.latest)) {
|
||||||
|
throw new Error(`Invalid latest flavor entry: ${input}`);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'prefix': {
|
||||||
|
flavor.prefix = parts[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'suffix': {
|
||||||
|
flavor.suffix = parts[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
throw new Error(`Unknown entry: ${input}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.startGroup(`Processing flavor input`);
|
||||||
|
core.info(`latest=${flavor.latest}`);
|
||||||
|
core.info(`prefix=${flavor.prefix}`);
|
||||||
|
core.info(`suffix=${flavor.suffix}`);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
|
return flavor;
|
||||||
|
}
|
48
src/main.ts
48
src/main.ts
@@ -1,4 +1,5 @@
|
|||||||
import {getInputs, Inputs} from './context';
|
import * as fs from 'fs';
|
||||||
|
import {getInputs, Inputs, setOutput} from './context';
|
||||||
import * as github from './github';
|
import * as github from './github';
|
||||||
import {Meta, Version} from './meta';
|
import {Meta, Version} from './meta';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
@@ -27,27 +28,44 @@ async function run() {
|
|||||||
|
|
||||||
const meta: Meta = new Meta(inputs, context, repo);
|
const meta: Meta = new Meta(inputs, context, repo);
|
||||||
|
|
||||||
const version: Version = meta.version();
|
const version: Version = meta.version;
|
||||||
core.startGroup(`Docker image version`);
|
if (meta.version.main == undefined || meta.version.main.length == 0) {
|
||||||
core.info(version.version || '');
|
core.warning(`No Docker image version has been generated. Check tags input.`);
|
||||||
core.endGroup();
|
} else {
|
||||||
core.setOutput('version', version.version || '');
|
core.startGroup(`Docker image version`);
|
||||||
|
core.info(version.main || '');
|
||||||
const tags: Array<string> = meta.tags();
|
core.endGroup();
|
||||||
core.startGroup(`Docker tags`);
|
|
||||||
for (let tag of tags) {
|
|
||||||
core.info(tag);
|
|
||||||
}
|
}
|
||||||
core.endGroup();
|
setOutput('version', version.main || '');
|
||||||
core.setOutput('tags', tags.join(inputs.sepTags));
|
|
||||||
|
|
||||||
const labels: Array<string> = meta.labels();
|
// Docker tags
|
||||||
|
const tags: Array<string> = meta.getTags();
|
||||||
|
if (tags.length == 0) {
|
||||||
|
core.warning('No Docker tag has been generated. Check tags input.');
|
||||||
|
} else {
|
||||||
|
core.startGroup(`Docker tags`);
|
||||||
|
for (let tag of tags) {
|
||||||
|
core.info(tag);
|
||||||
|
}
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
setOutput('tags', tags.join(inputs.sepTags));
|
||||||
|
|
||||||
|
// Docker labels
|
||||||
|
const labels: Array<string> = meta.getLabels();
|
||||||
core.startGroup(`Docker labels`);
|
core.startGroup(`Docker labels`);
|
||||||
for (let label of labels) {
|
for (let label of labels) {
|
||||||
core.info(label);
|
core.info(label);
|
||||||
}
|
}
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
core.setOutput('labels', labels.join(inputs.sepTags));
|
setOutput('labels', labels.join(inputs.sepLabels));
|
||||||
|
|
||||||
|
// Bake definition file
|
||||||
|
const bakeFile: string = meta.getBakeFile();
|
||||||
|
core.startGroup(`Bake definition file`);
|
||||||
|
core.info(fs.readFileSync(bakeFile, 'utf8'));
|
||||||
|
core.endGroup();
|
||||||
|
setOutput('bake-file', bakeFile);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
345
src/meta.ts
345
src/meta.ts
@@ -1,99 +1,348 @@
|
|||||||
import * as handlebars from 'handlebars';
|
import * as handlebars from 'handlebars';
|
||||||
import * as moment from 'moment';
|
import * as fs from 'fs';
|
||||||
import {Inputs} from './context';
|
import * as path from 'path';
|
||||||
|
import moment from 'moment';
|
||||||
|
import * as semver from 'semver';
|
||||||
|
import {Inputs, tmpDir} from './context';
|
||||||
|
import * as tcl from './tag';
|
||||||
|
import * as fcl from './flavor';
|
||||||
|
import * as core from '@actions/core';
|
||||||
import {Context} from '@actions/github/lib/context';
|
import {Context} from '@actions/github/lib/context';
|
||||||
import {ReposGetResponseData} from '@octokit/types';
|
import {ReposGetResponseData} from '@octokit/types';
|
||||||
|
|
||||||
export interface Version {
|
export interface Version {
|
||||||
version: string | undefined;
|
main: string | undefined;
|
||||||
latest: boolean;
|
partial: string[];
|
||||||
|
latest: boolean | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Meta {
|
export class Meta {
|
||||||
|
public readonly version: Version;
|
||||||
|
|
||||||
private readonly inputs: Inputs;
|
private readonly inputs: Inputs;
|
||||||
private readonly context: Context;
|
private readonly context: Context;
|
||||||
private readonly repo: ReposGetResponseData;
|
private readonly repo: ReposGetResponseData;
|
||||||
|
private readonly tags: tcl.Tag[];
|
||||||
|
private readonly flavor: fcl.Flavor;
|
||||||
private readonly date: Date;
|
private readonly date: Date;
|
||||||
|
|
||||||
constructor(inputs: Inputs, context: Context, repo: ReposGetResponseData) {
|
constructor(inputs: Inputs, context: Context, repo: ReposGetResponseData) {
|
||||||
this.inputs = inputs;
|
this.inputs = inputs;
|
||||||
if (!this.inputs.tagEdgeBranch) {
|
|
||||||
this.inputs.tagEdgeBranch = repo.default_branch;
|
|
||||||
}
|
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.repo = repo;
|
this.repo = repo;
|
||||||
|
this.tags = tcl.Transform(inputs.tags);
|
||||||
|
this.flavor = fcl.Transform(inputs.flavor);
|
||||||
this.date = new Date();
|
this.date = new Date();
|
||||||
|
this.version = this.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public version(): Version {
|
private getVersion(): Version {
|
||||||
const currentDate = this.date;
|
let version: Version = {
|
||||||
const version: Version = {
|
main: undefined,
|
||||||
version: undefined,
|
partial: [],
|
||||||
latest: false
|
latest: undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
if (/schedule/.test(this.context.eventName)) {
|
for (const tag of this.tags) {
|
||||||
version.version = handlebars.compile(this.inputs.tagSchedule)({
|
if (!/true/i.test(tag.attrs['enable'])) {
|
||||||
date: function (format) {
|
continue;
|
||||||
return moment(currentDate).utc().format(format);
|
}
|
||||||
|
switch (tag.type) {
|
||||||
|
case tcl.Type.Schedule: {
|
||||||
|
version = this.procSchedule(version, tag);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
case tcl.Type.Semver: {
|
||||||
} else if (/^refs\/tags\//.test(this.context.ref)) {
|
version = this.procSemver(version, tag);
|
||||||
version.version = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
break;
|
||||||
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 {
|
|
||||||
tagMatch = version.version.match(this.inputs.tagMatch);
|
|
||||||
}
|
}
|
||||||
if (tagMatch) {
|
case tcl.Type.Match: {
|
||||||
version.version = tagMatch[this.inputs.tagMatchGroup];
|
version = this.procMatch(version, tag);
|
||||||
version.latest = this.inputs.tagMatchLatest;
|
break;
|
||||||
|
}
|
||||||
|
case tcl.Type.Ref: {
|
||||||
|
if (tag.attrs['event'] == tcl.RefEvent.Branch) {
|
||||||
|
version = this.procRefBranch(version, tag);
|
||||||
|
} else if (tag.attrs['event'] == tcl.RefEvent.Tag) {
|
||||||
|
version = this.procRefTag(version, tag);
|
||||||
|
} else if (tag.attrs['event'] == tcl.RefEvent.PR) {
|
||||||
|
version = this.procRefPr(version, tag);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case tcl.Type.Edge: {
|
||||||
|
version = this.procEdge(version, tag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case tcl.Type.Raw: {
|
||||||
|
version = this.procRaw(version, tag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case tcl.Type.Sha: {
|
||||||
|
version = this.procSha(version, tag);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (/^refs\/heads\//.test(this.context.ref)) {
|
}
|
||||||
version.version = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
|
||||||
if (this.inputs.tagEdge && this.inputs.tagEdgeBranch === version.version) {
|
version.partial = version.partial.filter((item, index) => version.partial.indexOf(item) === index);
|
||||||
version.version = 'edge';
|
if (version.latest == undefined) {
|
||||||
}
|
version.latest = false;
|
||||||
} else if (/^refs\/pull\//.test(this.context.ref)) {
|
|
||||||
version.version = `pr-${this.context.ref.replace(/^refs\/pull\//g, '').replace(/\/merge$/g, '')}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public tags(): Array<string> {
|
private procSchedule(version: Version, tag: tcl.Tag): Version {
|
||||||
const version: Version = this.version();
|
if (!/schedule/.test(this.context.eventName)) {
|
||||||
if (!version.version) {
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentDate = this.date;
|
||||||
|
const vraw = this.setValue(
|
||||||
|
handlebars.compile(tag.attrs['pattern'])({
|
||||||
|
date: function (format) {
|
||||||
|
return moment(currentDate).utc().format(format);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
tag
|
||||||
|
);
|
||||||
|
|
||||||
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private procSemver(version: Version, tag: tcl.Tag): Version {
|
||||||
|
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
let vraw: string;
|
||||||
|
if (tag.attrs['value'].length > 0) {
|
||||||
|
vraw = this.setGlobalExp(tag.attrs['value']);
|
||||||
|
} else {
|
||||||
|
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||||
|
}
|
||||||
|
if (!semver.valid(vraw)) {
|
||||||
|
core.warning(`${vraw} is not a valid semver. More info: https://semver.org/`);
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
let latest: boolean = false;
|
||||||
|
const sver = semver.parse(vraw, {
|
||||||
|
includePrerelease: true
|
||||||
|
});
|
||||||
|
if (semver.prerelease(vraw)) {
|
||||||
|
vraw = this.setValue(handlebars.compile('{{version}}')(sver), tag);
|
||||||
|
} else {
|
||||||
|
vraw = this.setValue(handlebars.compile(tag.attrs['pattern'])(sver), tag);
|
||||||
|
latest = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private procMatch(version: Version, tag: tcl.Tag): Version {
|
||||||
|
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
let vraw: string;
|
||||||
|
if (tag.attrs['value'].length > 0) {
|
||||||
|
vraw = this.setGlobalExp(tag.attrs['value']);
|
||||||
|
} else {
|
||||||
|
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||||
|
}
|
||||||
|
|
||||||
|
let latest: boolean = false;
|
||||||
|
let tmatch;
|
||||||
|
const isRegEx = tag.attrs['pattern'].match(/^\/(.+)\/(.*)$/);
|
||||||
|
if (isRegEx) {
|
||||||
|
tmatch = vraw.match(new RegExp(isRegEx[1], isRegEx[2]));
|
||||||
|
} else {
|
||||||
|
tmatch = vraw.match(tag.attrs['pattern']);
|
||||||
|
}
|
||||||
|
if (!tmatch) {
|
||||||
|
core.warning(`${tag.attrs['pattern']} does not match ${vraw}.`);
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
if (typeof tmatch[tag.attrs['group']] === 'undefined') {
|
||||||
|
core.warning(`Group ${tag.attrs['group']} does not exist for ${tag.attrs['pattern']} pattern.`);
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
vraw = this.setValue(tmatch[tag.attrs['group']], tag);
|
||||||
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? true : this.flavor.latest == 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private procRefBranch(version: Version, tag: tcl.Tag): Version {
|
||||||
|
if (!/^refs\/heads\//.test(this.context.ref)) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
const vraw = this.setValue(this.context.ref.replace(/^refs\/heads\//g, '').replace(/[^a-zA-Z0-9._-]+/g, '-'), tag);
|
||||||
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private procRefTag(version: Version, tag: tcl.Tag): Version {
|
||||||
|
if (!/^refs\/tags\//.test(this.context.ref)) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
const vraw = this.setValue(this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-'), tag);
|
||||||
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? true : this.flavor.latest == 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private procRefPr(version: Version, tag: tcl.Tag): Version {
|
||||||
|
if (!/^refs\/pull\//.test(this.context.ref)) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
const vraw = this.setValue(this.context.ref.replace(/^refs\/pull\//g, '').replace(/\/merge$/g, ''), tag);
|
||||||
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private procEdge(version: Version, tag: tcl.Tag): Version {
|
||||||
|
if (!/^refs\/heads\//.test(this.context.ref)) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
let val = this.context.ref.replace(/^refs\/heads\//g, '').replace(/[^a-zA-Z0-9._-]+/g, '-');
|
||||||
|
if (tag.attrs['branch'].length == 0) {
|
||||||
|
tag.attrs['branch'] = this.repo.default_branch;
|
||||||
|
}
|
||||||
|
if (tag.attrs['branch'] === val) {
|
||||||
|
val = 'edge';
|
||||||
|
}
|
||||||
|
|
||||||
|
const vraw = this.setValue(val, tag);
|
||||||
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private procRaw(version: Version, tag: tcl.Tag): Version {
|
||||||
|
const vraw = this.setValue(this.setGlobalExp(tag.attrs['value']), tag);
|
||||||
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private procSha(version: Version, tag: tcl.Tag): Version {
|
||||||
|
if (!this.context.sha) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
const vraw = this.setValue(this.context.sha.substr(0, 7), tag);
|
||||||
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private static setVersion(version: Version, val: string, latest: boolean): Version {
|
||||||
|
if (val.length == 0) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
if (version.main == undefined) {
|
||||||
|
version.main = val;
|
||||||
|
} else if (val !== version.main) {
|
||||||
|
version.partial.push(val);
|
||||||
|
}
|
||||||
|
if (version.latest == undefined) {
|
||||||
|
version.latest = latest;
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
private setValue(val: string, tag: tcl.Tag): string {
|
||||||
|
if (tag.attrs.hasOwnProperty('prefix')) {
|
||||||
|
val = `${this.setGlobalExp(tag.attrs['prefix'])}${val}`;
|
||||||
|
} else if (this.flavor.prefix.length > 0) {
|
||||||
|
val = `${this.setGlobalExp(this.flavor.prefix)}${val}`;
|
||||||
|
}
|
||||||
|
if (tag.attrs.hasOwnProperty('suffix')) {
|
||||||
|
val = `${val}${this.setGlobalExp(tag.attrs['suffix'])}`;
|
||||||
|
} else if (this.flavor.suffix.length > 0) {
|
||||||
|
val = `${val}${this.setGlobalExp(this.flavor.suffix)}`;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
private setGlobalExp(val): string {
|
||||||
|
const ctx = this.context;
|
||||||
|
return handlebars.compile(val)({
|
||||||
|
branch: function () {
|
||||||
|
if (!/^refs\/heads\//.test(ctx.ref)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return ctx.ref.replace(/^refs\/heads\//g, '').replace(/[^a-zA-Z0-9._-]+/g, '-');
|
||||||
|
},
|
||||||
|
tag: function () {
|
||||||
|
if (!/^refs\/tags\//.test(ctx.ref)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return ctx.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||||
|
},
|
||||||
|
sha: function () {
|
||||||
|
return ctx.sha.substr(0, 7);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public getTags(): Array<string> {
|
||||||
|
if (!this.version.main) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
let tags: Array<string> = [];
|
let tags: Array<string> = [];
|
||||||
for (const image of this.inputs.images) {
|
for (const image of this.inputs.images) {
|
||||||
tags.push(`${image}:${version.version}`);
|
const imageLc = image.toLowerCase();
|
||||||
if (version.latest) {
|
tags.push(`${imageLc}:${this.version.main}`);
|
||||||
tags.push(`${image}:latest`);
|
for (const partial of this.version.partial) {
|
||||||
|
tags.push(`${imageLc}:${partial}`);
|
||||||
}
|
}
|
||||||
if (this.context.sha && this.inputs.tagSha) {
|
if (this.version.latest) {
|
||||||
tags.push(`${image}:sha-${this.context.sha.substr(0, 7)}`);
|
tags.push(`${imageLc}:latest`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public labels(): Array<string> {
|
public getLabels(): Array<string> {
|
||||||
return [
|
let labels: Array<string> = [
|
||||||
`org.opencontainers.image.title=${this.repo.name || ''}`,
|
`org.opencontainers.image.title=${this.repo.name || ''}`,
|
||||||
`org.opencontainers.image.description=${this.repo.description || ''}`,
|
`org.opencontainers.image.description=${this.repo.description || ''}`,
|
||||||
`org.opencontainers.image.url=${this.repo.html_url || ''}`,
|
`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.version=${this.version.main || ''}`,
|
||||||
`org.opencontainers.image.created=${this.date.toISOString()}`,
|
`org.opencontainers.image.created=${this.date.toISOString()}`,
|
||||||
`org.opencontainers.image.revision=${this.context.sha || ''}`,
|
`org.opencontainers.image.revision=${this.context.sha || ''}`,
|
||||||
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
|
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
|
||||||
];
|
];
|
||||||
|
labels.push(...this.inputs.labels);
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getBakeFile(): string {
|
||||||
|
let jsonLabels = {};
|
||||||
|
for (let label of this.getLabels()) {
|
||||||
|
const matches = label.match(/([^=]*)=(.*)/);
|
||||||
|
if (!matches) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
jsonLabels[matches[1]] = matches[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
const bakeFile = path.join(tmpDir(), 'docker-metadata-action-bake.json').split(path.sep).join(path.posix.sep);
|
||||||
|
fs.writeFileSync(
|
||||||
|
bakeFile,
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
target: {
|
||||||
|
[this.inputs.bakeTarget]: {
|
||||||
|
tags: this.getTags(),
|
||||||
|
labels: jsonLabels,
|
||||||
|
args: {
|
||||||
|
DOCKER_META_IMAGES: this.inputs.images.join(','),
|
||||||
|
DOCKER_META_VERSION: this.version.main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return bakeFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
193
src/tag.ts
Normal file
193
src/tag.ts
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
import csvparse from 'csv-parse/lib/sync';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
export enum Type {
|
||||||
|
Schedule = 'schedule',
|
||||||
|
Semver = 'semver',
|
||||||
|
Match = 'match',
|
||||||
|
Edge = 'edge',
|
||||||
|
Ref = 'ref',
|
||||||
|
Raw = 'raw',
|
||||||
|
Sha = 'sha'
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum RefEvent {
|
||||||
|
Branch = 'branch',
|
||||||
|
Tag = 'tag',
|
||||||
|
PR = 'pr'
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Tag {
|
||||||
|
public type?: Type;
|
||||||
|
public attrs: Record<string, string>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.attrs = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public toString(): string {
|
||||||
|
const out: string[] = [`type=${this.type}`];
|
||||||
|
for (let attr in this.attrs) {
|
||||||
|
out.push(`${attr}=${this.attrs[attr]}`);
|
||||||
|
}
|
||||||
|
return out.join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DefaultPriorities: Record<Type, string> = {
|
||||||
|
[Type.Schedule]: '1000',
|
||||||
|
[Type.Semver]: '900',
|
||||||
|
[Type.Match]: '800',
|
||||||
|
[Type.Edge]: '700',
|
||||||
|
[Type.Ref]: '600',
|
||||||
|
[Type.Raw]: '200',
|
||||||
|
[Type.Sha]: '100'
|
||||||
|
};
|
||||||
|
|
||||||
|
export function Transform(inputs: string[]): Tag[] {
|
||||||
|
const tags: Tag[] = [];
|
||||||
|
if (inputs.length == 0) {
|
||||||
|
// prettier-ignore
|
||||||
|
inputs = [
|
||||||
|
`type=schedule`,
|
||||||
|
`type=ref,event=${RefEvent.Branch}`,
|
||||||
|
`type=ref,event=${RefEvent.Tag}`,
|
||||||
|
`type=ref,event=${RefEvent.PR}`
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const input of inputs) {
|
||||||
|
tags.push(Parse(input));
|
||||||
|
}
|
||||||
|
const sorted = tags.sort((tag1, tag2) => {
|
||||||
|
if (Number(tag1.attrs['priority']) < Number(tag2.attrs['priority'])) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (Number(tag1.attrs['priority']) > Number(tag2.attrs['priority'])) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
core.startGroup(`Processing tags input`);
|
||||||
|
for (const tag of sorted) {
|
||||||
|
core.info(tag.toString());
|
||||||
|
}
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
|
return sorted;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Parse(s: string): Tag {
|
||||||
|
const fields = csvparse(s, {
|
||||||
|
relaxColumnCount: true,
|
||||||
|
skipLinesWithEmptyValues: true
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
const tag = new Tag();
|
||||||
|
for (const field of fields) {
|
||||||
|
const parts = field.toString().split('=', 2);
|
||||||
|
if (parts.length == 1) {
|
||||||
|
tag.attrs['value'] = parts[0].trim();
|
||||||
|
} else {
|
||||||
|
const key = parts[0].trim().toLowerCase();
|
||||||
|
const value = parts[1].trim();
|
||||||
|
switch (key) {
|
||||||
|
case 'type': {
|
||||||
|
if (!Object.values(Type).includes(value)) {
|
||||||
|
throw new Error(`Unknown type attribute: ${value}`);
|
||||||
|
}
|
||||||
|
tag.type = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
tag.attrs[key] = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tag.type == undefined) {
|
||||||
|
tag.type = Type.Raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (tag.type) {
|
||||||
|
case Type.Schedule: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||||
|
tag.attrs['pattern'] = 'nightly';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Semver: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||||
|
throw new Error(`Missing pattern attribute for ${s}`);
|
||||||
|
}
|
||||||
|
if (!tag.attrs.hasOwnProperty('value')) {
|
||||||
|
tag.attrs['value'] = '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Match: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||||
|
throw new Error(`Missing pattern attribute for ${s}`);
|
||||||
|
}
|
||||||
|
if (!tag.attrs.hasOwnProperty('group')) {
|
||||||
|
tag.attrs['group'] = '0';
|
||||||
|
}
|
||||||
|
if (isNaN(+tag.attrs['group'])) {
|
||||||
|
throw new Error(`Invalid match group for ${s}`);
|
||||||
|
}
|
||||||
|
if (!tag.attrs.hasOwnProperty('value')) {
|
||||||
|
tag.attrs['value'] = '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Edge: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('branch')) {
|
||||||
|
tag.attrs['branch'] = '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Ref: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('event')) {
|
||||||
|
throw new Error(`Missing event attribute for ${s}`);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!Object.keys(RefEvent)
|
||||||
|
.map(k => RefEvent[k])
|
||||||
|
.includes(tag.attrs['event'])
|
||||||
|
) {
|
||||||
|
throw new Error(`Invalid event for ${s}`);
|
||||||
|
}
|
||||||
|
if (tag.attrs['event'] == RefEvent.PR && !tag.attrs.hasOwnProperty('prefix')) {
|
||||||
|
tag.attrs['prefix'] = 'pr-';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Raw: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('value')) {
|
||||||
|
throw new Error(`Missing value attribute for ${s}`);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Sha: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('prefix')) {
|
||||||
|
tag.attrs['prefix'] = 'sha-';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tag.attrs.hasOwnProperty('enable')) {
|
||||||
|
tag.attrs['enable'] = 'true';
|
||||||
|
}
|
||||||
|
if (!tag.attrs.hasOwnProperty('priority')) {
|
||||||
|
tag.attrs['priority'] = DefaultPriorities[tag.type];
|
||||||
|
}
|
||||||
|
if (!['true', 'false'].includes(tag.attrs['enable'])) {
|
||||||
|
throw new Error(`Invalid value for enable attribute: ${tag.attrs['enable']}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
38
test/docker-bake.hcl
Normal file
38
test/docker-bake.hcl
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
target "docker-metadata-action" {}
|
||||||
|
|
||||||
|
group "default" {
|
||||||
|
targets = ["db", "app"]
|
||||||
|
}
|
||||||
|
|
||||||
|
group "release" {
|
||||||
|
targets = ["db", "app-plus"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "db" {
|
||||||
|
context = "./test"
|
||||||
|
tags = ["docker.io/tonistiigi/db"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "app" {
|
||||||
|
inherits = ["docker-metadata-action"]
|
||||||
|
context = "./test"
|
||||||
|
dockerfile = "Dockerfile"
|
||||||
|
args = {
|
||||||
|
name = "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target "cross" {
|
||||||
|
platforms = [
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm64",
|
||||||
|
"linux/386"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "app-plus" {
|
||||||
|
inherits = ["app", "cross"]
|
||||||
|
args = {
|
||||||
|
IAMPLUS = "true"
|
||||||
|
}
|
||||||
|
}
|
@@ -11,9 +11,11 @@
|
|||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"esModuleInterop": false,
|
"esModuleInterop": true,
|
||||||
"resolveJsonModule": true,
|
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"**/*.test.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
71
yarn.lock
71
yarn.lock
@@ -2,10 +2,10 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@actions/core@^1.2.6":
|
"@actions/core@^1.2.7":
|
||||||
version "1.2.6"
|
version "1.2.7"
|
||||||
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09"
|
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.7.tgz#594f8c45b213f0146e4be7eda8ae5cf4e198e5ab"
|
||||||
integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==
|
integrity sha512-kzLFD5BgEvq6ubcxdgPbRKGD2Qrgya/5j+wh4LZzqT915I0V3rED+MvjH6NXghbvk1MXknpNNQ3uKjXSEN00Ig==
|
||||||
|
|
||||||
"@actions/github@^4.0.0":
|
"@actions/github@^4.0.0":
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
@@ -1176,6 +1176,11 @@ cssstyle@^2.2.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
cssom "~0.3.6"
|
cssom "~0.3.6"
|
||||||
|
|
||||||
|
csv-parse@^4.15.4:
|
||||||
|
version "4.15.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.15.4.tgz#ad1ec62aaf71a642982dfcb81f1848184d691db5"
|
||||||
|
integrity sha512-OdBbFc0yZhOm17lSxqkirrHlFFVpKRT0wp4DAGoJelsP3LbGzV9LNr7XmM/lrr0uGkCtaqac9UhP8PDHXOAbMg==
|
||||||
|
|
||||||
dashdash@^1.12.0:
|
dashdash@^1.12.0:
|
||||||
version "1.14.1"
|
version "1.14.1"
|
||||||
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
|
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
|
||||||
@@ -1622,10 +1627,10 @@ growly@^1.3.0:
|
|||||||
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
|
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
|
||||||
integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=
|
integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=
|
||||||
|
|
||||||
handlebars@^4.7.6:
|
handlebars@^4.7.7:
|
||||||
version "4.7.6"
|
version "4.7.7"
|
||||||
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.6.tgz#d4c05c1baf90e9945f77aa68a7a219aa4a7df74e"
|
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1"
|
||||||
integrity sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==
|
integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==
|
||||||
dependencies:
|
dependencies:
|
||||||
minimist "^1.2.5"
|
minimist "^1.2.5"
|
||||||
neo-async "^2.6.0"
|
neo-async "^2.6.0"
|
||||||
@@ -1696,9 +1701,9 @@ has@^1.0.3:
|
|||||||
function-bind "^1.1.1"
|
function-bind "^1.1.1"
|
||||||
|
|
||||||
hosted-git-info@^2.1.4:
|
hosted-git-info@^2.1.4:
|
||||||
version "2.8.8"
|
version "2.8.9"
|
||||||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488"
|
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
|
||||||
integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==
|
integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
|
||||||
|
|
||||||
html-encoding-sniffer@^2.0.1:
|
html-encoding-sniffer@^2.0.1:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
@@ -2541,9 +2546,16 @@ lodash.sortby@^4.7.0:
|
|||||||
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
|
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
|
||||||
|
|
||||||
lodash@^4.17.19:
|
lodash@^4.17.19:
|
||||||
version "4.17.20"
|
version "4.17.21"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||||
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
|
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||||
|
|
||||||
|
lru-cache@^6.0.0:
|
||||||
|
version "6.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
||||||
|
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
|
||||||
|
dependencies:
|
||||||
|
yallist "^4.0.0"
|
||||||
|
|
||||||
make-dir@^3.0.0:
|
make-dir@^3.0.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
@@ -2713,9 +2725,9 @@ node-modules-regexp@^1.0.0:
|
|||||||
integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=
|
integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=
|
||||||
|
|
||||||
node-notifier@^8.0.0:
|
node-notifier@^8.0.0:
|
||||||
version "8.0.0"
|
version "8.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.0.tgz#a7eee2d51da6d0f7ff5094bc7108c911240c1620"
|
resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.1.tgz#f86e89bbc925f2b068784b31f382afdc6ca56be1"
|
||||||
integrity sha512-46z7DUmcjoYdaWyXouuFNNfUo6eFa94t23c53c+lG/9Cvauk4a98rAUp9672X5dxGdQmLpPzTxzu8f/OeEPaFA==
|
integrity sha512-BvEXF+UmsnAfYfoapKM9nGxnP+Wn7P91YfXmrKnfcYCx6VBeoN5Ez5Ogck6I8Bi5k4RlpqRYaw75pAwzX9OphA==
|
||||||
dependencies:
|
dependencies:
|
||||||
growly "^1.3.0"
|
growly "^1.3.0"
|
||||||
is-wsl "^2.2.0"
|
is-wsl "^2.2.0"
|
||||||
@@ -3163,10 +3175,12 @@ saxes@^5.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
||||||
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
||||||
|
|
||||||
semver@7.x, semver@^7.3.2:
|
semver@7.x, semver@^7.3.2, semver@^7.3.5:
|
||||||
version "7.3.2"
|
version "7.3.5"
|
||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
|
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
|
||||||
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==
|
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
|
||||||
|
dependencies:
|
||||||
|
lru-cache "^6.0.0"
|
||||||
|
|
||||||
semver@^6.0.0, semver@^6.3.0:
|
semver@^6.0.0, semver@^6.3.0:
|
||||||
version "6.3.0"
|
version "6.3.0"
|
||||||
@@ -3653,9 +3667,9 @@ uuid@^3.3.2:
|
|||||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||||
|
|
||||||
uuid@^8.3.0:
|
uuid@^8.3.0:
|
||||||
version "8.3.1"
|
version "8.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31"
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||||
integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==
|
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||||
|
|
||||||
v8-to-istanbul@^6.0.1:
|
v8-to-istanbul@^6.0.1:
|
||||||
version "6.0.1"
|
version "6.0.1"
|
||||||
@@ -3804,9 +3818,14 @@ xmlchars@^2.2.0:
|
|||||||
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
|
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
|
||||||
|
|
||||||
y18n@^4.0.0:
|
y18n@^4.0.0:
|
||||||
|
version "4.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
|
||||||
|
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==
|
||||||
|
|
||||||
|
yallist@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
|
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
||||||
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
|
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
||||||
|
|
||||||
yargs-parser@20.x:
|
yargs-parser@20.x:
|
||||||
version "20.2.3"
|
version "20.2.3"
|
||||||
|
Reference in New Issue
Block a user