Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9da1e66de9 | ||
|
521a3c5ada | ||
|
7433b42479 | ||
|
1a8a264b95 | ||
|
e04b4d01a9 | ||
|
ac90ddf06e | ||
|
972129059a | ||
|
b909bd34ef | ||
|
72654174f7 | ||
|
4545671ec8 | ||
|
5c38e5df03 |
@@ -1,5 +1,2 @@
|
|||||||
/.dev
|
|
||||||
/coverage
|
/coverage
|
||||||
/dist
|
|
||||||
/lib
|
|
||||||
/node_modules
|
/node_modules
|
||||||
|
6
.github/CONTRIBUTING.md
vendored
6
.github/CONTRIBUTING.md
vendored
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
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)
|
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).
|
to the public under the [project's open source license](LICENSE).
|
||||||
|
|
||||||
## Submitting a pull request
|
## Submitting a pull request
|
||||||
@@ -28,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)
|
||||||
|
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -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.
|
||||||
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -72,9 +72,9 @@ 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'
|
||||||
|
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,5 +1,20 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.2.0 (2021/04/03)
|
||||||
|
|
||||||
|
* Improve logging (#58)
|
||||||
|
* Fix README (#56)
|
||||||
|
|
||||||
|
## 2.1.1 (2021/03/30)
|
||||||
|
|
||||||
|
* Fix `enable` tag attribute (#53)
|
||||||
|
* Bump y18n from 4.0.0 to 4.0.1 (#54)
|
||||||
|
|
||||||
|
## 2.1.0 (2021/03/29)
|
||||||
|
|
||||||
|
* Bump semver from 7.3.4 to 7.3.5 (#49)
|
||||||
|
* Enhance workflow (#51)
|
||||||
|
|
||||||
## 2.0.0 (2021/03/29)
|
## 2.0.0 (2021/03/29)
|
||||||
|
|
||||||
This release includes significant changes (#50). Please read the [upgrade notes](UPGRADE.md) for a smooth migration.
|
This release includes significant changes (#50). Please read the [upgrade notes](UPGRADE.md) for a smooth migration.
|
||||||
|
13
README.md
13
README.md
@@ -128,7 +128,6 @@ jobs:
|
|||||||
images: name/app
|
images: name/app
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=tag
|
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
@@ -200,7 +199,6 @@ jobs:
|
|||||||
images: name/app
|
images: name/app
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=tag
|
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
@@ -254,7 +252,7 @@ Following inputs can be used as `step.with` keys
|
|||||||
|
|
||||||
> `List` type is a newline-delimited string
|
> `List` type is a newline-delimited string
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> label-custom: |
|
> labels: |
|
||||||
> org.opencontainers.image.title=MyCustomTitle
|
> org.opencontainers.image.title=MyCustomTitle
|
||||||
> org.opencontainers.image.description=Another description
|
> org.opencontainers.image.description=Another description
|
||||||
> org.opencontainers.image.vendor=MyCompany
|
> org.opencontainers.image.vendor=MyCompany
|
||||||
@@ -310,7 +308,6 @@ the form of a key-value pair list in CSV format to remove limitations intrinsica
|
|||||||
tags: |
|
tags: |
|
||||||
type=schedule
|
type=schedule
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=tag
|
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
@@ -423,9 +420,7 @@ tags: |
|
|||||||
```yaml
|
```yaml
|
||||||
tags: |
|
tags: |
|
||||||
# minimal
|
# minimal
|
||||||
type=match,pattern=\d{8}
|
type=match,pattern=\d.\d.\d
|
||||||
# double quotes if comma in pattern
|
|
||||||
type=match,"pattern=\d{1,3}.\d{1,3}.\d{1,3}"
|
|
||||||
# define match group
|
# define match group
|
||||||
type=match,pattern=v(.*),group=1
|
type=match,pattern=v(.*),group=1
|
||||||
# use custom value instead of git tag
|
# use custom value instead of git tag
|
||||||
@@ -438,7 +433,7 @@ a custom value through `value` attribute.
|
|||||||
|
|
||||||
| Git tag | Pattern | Group | Output |
|
| Git tag | Pattern | Group | Output |
|
||||||
|-------------------------|-------------------------------|---------|------------------------|
|
|-------------------------|-------------------------------|---------|------------------------|
|
||||||
| `v1.2.3` | `\d{1,3}.\d{1,3}.\d{1,3}` | `0` | `1.2.3` |
|
| `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(.*)` | `1` | `2.0.8-beta.67` |
|
||||||
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | `2.0` |
|
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | `2.0` |
|
||||||
| `20200110-RC2` | `\d+` | `0` | `20200110` |
|
| `20200110-RC2` | `\d+` | `0` | `20200110` |
|
||||||
@@ -447,7 +442,7 @@ Extended attributes and default values:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
tags: |
|
tags: |
|
||||||
type=group,enable=true,priority=800,prefix=,suffix=,pattern=,group=0,value=
|
type=match,enable=true,priority=800,prefix=,suffix=,pattern=,group=0,value=
|
||||||
```
|
```
|
||||||
|
|
||||||
### `type=edge`
|
### `type=edge`
|
||||||
|
@@ -273,7 +273,6 @@ jobs:
|
|||||||
images: name/app
|
images: name/app
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=tag
|
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
@@ -557,6 +557,35 @@ describe('push', () => {
|
|||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'push16',
|
||||||
|
'event_push_defbranch.env',
|
||||||
|
{
|
||||||
|
images: ['user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=match,enable=false,pattern=v(.*),group=1,value=v1.2.3`,
|
||||||
|
`type=edge`
|
||||||
|
],
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'edge',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'user/app:edge'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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=edge",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
]
|
]
|
||||||
])('given %p with %p event', tagsLabelsTest);
|
])('given %p with %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
@@ -684,7 +713,7 @@ describe('tag', () => {
|
|||||||
{
|
{
|
||||||
images: ['org/app', 'ghcr.io/user/app'],
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}.\\d{1,3}"`
|
`type=match,"pattern=\\d.\\d.\\d"`
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
@@ -715,7 +744,7 @@ describe('tag', () => {
|
|||||||
{
|
{
|
||||||
images: ['org/app', 'ghcr.io/user/app'],
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=match,"pattern=^v(\\d{1,3}.\\d{1,3}.\\d{1,3})$",group=1`
|
`type=match,"pattern=^v(\\d.\\d.\\d)$",group=1`
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
@@ -746,7 +775,7 @@ describe('tag', () => {
|
|||||||
{
|
{
|
||||||
images: ['org/app', 'ghcr.io/user/app'],
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}.\\d{1,3}-(alpha|beta).\\d{1,3}"`
|
`type=match,"pattern=\\d.\\d.\\d-(alpha|beta).\\d+"`
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
@@ -777,7 +806,7 @@ describe('tag', () => {
|
|||||||
{
|
{
|
||||||
images: ['org/app', 'ghcr.io/user/app'],
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}"`
|
`type=match,"pattern=\\d.\\d"`
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
@@ -808,7 +837,7 @@ describe('tag', () => {
|
|||||||
{
|
{
|
||||||
images: ['org/app', 'ghcr.io/user/app'],
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=match,"pattern=/^v(\\d{1,3}.\\d{1,3}.\\d{1,3})$/ig",group=1`,
|
`type=match,"pattern=/^v(\\d.\\d.\\d)$/ig",group=1`,
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
@@ -837,7 +866,7 @@ describe('tag', () => {
|
|||||||
{
|
{
|
||||||
images: ['org/app', 'ghcr.io/user/app'],
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}"`
|
`type=match,"pattern=\\d.\\d"`
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
@@ -1001,7 +1030,7 @@ describe('tag', () => {
|
|||||||
tags: [
|
tags: [
|
||||||
`type=raw,priority=2000,foo`,
|
`type=raw,priority=2000,foo`,
|
||||||
`type=semver,pattern={{version}}`,
|
`type=semver,pattern={{version}}`,
|
||||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}"`
|
`type=match,"pattern=\\d.\\d"`
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
@@ -1160,7 +1189,7 @@ describe('latest', () => {
|
|||||||
{
|
{
|
||||||
images: ['user/app'],
|
images: ['user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}.\\d{1,3}"`
|
`type=match,"pattern=\\d.\\d.\\d"`
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
@@ -1217,7 +1246,7 @@ describe('latest', () => {
|
|||||||
{
|
{
|
||||||
images: ['org/app', 'ghcr.io/user/app'],
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}.\\d{1,3}"`
|
`type=match,"pattern=\\d.\\d.\\d"`
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
@@ -2015,7 +2044,41 @@ describe('raw', () => {
|
|||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'raw10',
|
||||||
|
'event_push.env',
|
||||||
|
{
|
||||||
|
images: ['user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=raw,foo`,
|
||||||
|
`type=raw,bar,enable=false`,
|
||||||
|
`type=raw,baz,enable=true`
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`latest=false`
|
||||||
]
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'foo',
|
||||||
|
partial: ['baz'],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'user/app:foo',
|
||||||
|
'user/app:baz',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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=foo",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
])('given %p wth %p event', tagsLabelsTest);
|
])('given %p wth %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ describe('transform', () => {
|
|||||||
`type=raw,foo`,
|
`type=raw,foo`,
|
||||||
`type=edge`,
|
`type=edge`,
|
||||||
`type=semver,pattern={{version}}`,
|
`type=semver,pattern={{version}}`,
|
||||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}.\\d{1,3}"`
|
`type=match,"pattern=\\d.\\d.\\d",group=0`
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -44,7 +44,7 @@ describe('transform', () => {
|
|||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
"prefix": "",
|
||||||
"suffix": "",
|
"suffix": "",
|
||||||
"pattern": "\\d{1,3}.\\d{1,3}.\\d{1,3}",
|
"pattern": "\\d.\\d.\\d",
|
||||||
"group": "0",
|
"group": "0",
|
||||||
"value": ""
|
"value": ""
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ describe('parse', () => {
|
|||||||
false
|
false
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
`type=match,enable=true,"pattern=^v(\\d{1,3}.\\d{1,3}.\\d{1,3})$",group=1`,
|
`type=match,enable=true,"pattern=^v(\\d.\\d.\\d)$",group=1`,
|
||||||
{
|
{
|
||||||
type: Type.Match,
|
type: Type.Match,
|
||||||
attrs: {
|
attrs: {
|
||||||
@@ -212,7 +212,7 @@ describe('parse', () => {
|
|||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
"prefix": "",
|
||||||
"suffix": "",
|
"suffix": "",
|
||||||
"pattern": "^v(\\d{1,3}.\\d{1,3}.\\d{1,3})$",
|
"pattern": "^v(\\d.\\d.\\d)$",
|
||||||
"group": "1",
|
"group": "1",
|
||||||
"value": ""
|
"value": ""
|
||||||
}
|
}
|
||||||
|
@@ -1,51 +0,0 @@
|
|||||||
#syntax=docker/dockerfile:1.2
|
|
||||||
|
|
||||||
FROM node:12 AS deps
|
|
||||||
WORKDIR /src
|
|
||||||
COPY package.json yarn.lock ./
|
|
||||||
RUN --mount=type=cache,target=/src/node_modules \
|
|
||||||
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 --mount=type=cache,target=/src/node_modules \
|
|
||||||
yarn build
|
|
||||||
|
|
||||||
FROM deps AS test
|
|
||||||
ENV RUNNER_TEMP=/tmp/github_runner
|
|
||||||
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
|
||||||
COPY . .
|
|
||||||
RUN --mount=type=cache,target=/src/node_modules \
|
|
||||||
yarn run test
|
|
||||||
|
|
||||||
FROM scratch AS test-coverage
|
|
||||||
COPY --from=test /src/coverage /coverage/
|
|
||||||
|
|
||||||
FROM base AS run-format
|
|
||||||
RUN --mount=type=cache,target=/src/node_modules \
|
|
||||||
yarn run format
|
|
||||||
|
|
||||||
FROM scratch AS format
|
|
||||||
COPY --from=run-format /src/src/*.ts /src/
|
|
||||||
|
|
||||||
FROM base AS validate-format
|
|
||||||
RUN --mount=type=cache,target=/src/node_modules \
|
|
||||||
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"]
|
|
151
dist/index.js
generated
vendored
151
dist/index.js
generated
vendored
@@ -99,12 +99,32 @@ exports.asyncForEach = (array, callback) => __awaiter(void 0, void 0, void 0, fu
|
|||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 3716:
|
/***/ 3716:
|
||||||
/***/ ((__unused_webpack_module, exports) => {
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.Transform = void 0;
|
exports.Transform = void 0;
|
||||||
|
const core = __importStar(__webpack_require__(2186));
|
||||||
function Transform(inputs) {
|
function Transform(inputs) {
|
||||||
const flavor = {
|
const flavor = {
|
||||||
latest: 'auto',
|
latest: 'auto',
|
||||||
@@ -137,6 +157,11 @@ function Transform(inputs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
core.startGroup(`Processing flavor input`);
|
||||||
|
core.info(`latest=${flavor.latest}`);
|
||||||
|
core.info(`prefix=${flavor.prefix}`);
|
||||||
|
core.info(`suffix=${flavor.suffix}`);
|
||||||
|
core.endGroup();
|
||||||
return flavor;
|
return flavor;
|
||||||
}
|
}
|
||||||
exports.Transform = Transform;
|
exports.Transform = Transform;
|
||||||
@@ -361,6 +386,9 @@ class Meta {
|
|||||||
latest: undefined
|
latest: undefined
|
||||||
};
|
};
|
||||||
for (const tag of this.tags) {
|
for (const tag of this.tags) {
|
||||||
|
if (tag.attrs['enable'] == 'false') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (tag.type) {
|
switch (tag.type) {
|
||||||
case tcl.Type.Schedule: {
|
case tcl.Type.Schedule: {
|
||||||
version = this.procSchedule(version, tag);
|
version = this.procSchedule(version, tag);
|
||||||
@@ -687,12 +715,32 @@ exports.Meta = Meta;
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.Parse = exports.Transform = exports.DefaultPriorities = exports.RefEvent = exports.Type = void 0;
|
exports.Parse = exports.Transform = exports.DefaultPriorities = exports.Tag = exports.RefEvent = exports.Type = void 0;
|
||||||
const sync_1 = __importDefault(__webpack_require__(8750));
|
const sync_1 = __importDefault(__webpack_require__(8750));
|
||||||
|
const core = __importStar(__webpack_require__(2186));
|
||||||
var Type;
|
var Type;
|
||||||
(function (Type) {
|
(function (Type) {
|
||||||
Type["Schedule"] = "schedule";
|
Type["Schedule"] = "schedule";
|
||||||
@@ -709,6 +757,19 @@ var RefEvent;
|
|||||||
RefEvent["Tag"] = "tag";
|
RefEvent["Tag"] = "tag";
|
||||||
RefEvent["PR"] = "pr";
|
RefEvent["PR"] = "pr";
|
||||||
})(RefEvent = exports.RefEvent || (exports.RefEvent = {}));
|
})(RefEvent = exports.RefEvent || (exports.RefEvent = {}));
|
||||||
|
class Tag {
|
||||||
|
constructor() {
|
||||||
|
this.attrs = {};
|
||||||
|
}
|
||||||
|
toString() {
|
||||||
|
const out = [`type=${this.type}`];
|
||||||
|
for (let attr in this.attrs) {
|
||||||
|
out.push(`${attr}=${this.attrs[attr]}`);
|
||||||
|
}
|
||||||
|
return out.join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Tag = Tag;
|
||||||
exports.DefaultPriorities = {
|
exports.DefaultPriorities = {
|
||||||
[Type.Schedule]: '1000',
|
[Type.Schedule]: '1000',
|
||||||
[Type.Semver]: '900',
|
[Type.Semver]: '900',
|
||||||
@@ -732,7 +793,7 @@ function Transform(inputs) {
|
|||||||
for (const input of inputs) {
|
for (const input of inputs) {
|
||||||
tags.push(Parse(input));
|
tags.push(Parse(input));
|
||||||
}
|
}
|
||||||
return tags.sort((tag1, tag2) => {
|
const sorted = tags.sort((tag1, tag2) => {
|
||||||
if (Number(tag1.attrs['priority']) < Number(tag2.attrs['priority'])) {
|
if (Number(tag1.attrs['priority']) < Number(tag2.attrs['priority'])) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -741,6 +802,12 @@ function Transform(inputs) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
core.startGroup(`Processing tags input`);
|
||||||
|
for (const tag of sorted) {
|
||||||
|
core.info(tag.toString());
|
||||||
|
}
|
||||||
|
core.endGroup();
|
||||||
|
return sorted;
|
||||||
}
|
}
|
||||||
exports.Transform = Transform;
|
exports.Transform = Transform;
|
||||||
function Parse(s) {
|
function Parse(s) {
|
||||||
@@ -748,9 +815,7 @@ function Parse(s) {
|
|||||||
relaxColumnCount: true,
|
relaxColumnCount: true,
|
||||||
skipLinesWithEmptyValues: true
|
skipLinesWithEmptyValues: true
|
||||||
})[0];
|
})[0];
|
||||||
const tag = {
|
const tag = new Tag();
|
||||||
attrs: {}
|
|
||||||
};
|
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
const parts = field.toString().split('=', 2);
|
const parts = field.toString().split('=', 2);
|
||||||
if (parts.length == 1) {
|
if (parts.length == 1) {
|
||||||
@@ -20871,22 +20936,30 @@ module.exports = (versions, range, options) => {
|
|||||||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||||||
|
|
||||||
const Range = __webpack_require__(9828)
|
const Range = __webpack_require__(9828)
|
||||||
const { ANY } = __webpack_require__(1532)
|
const Comparator = __webpack_require__(1532)
|
||||||
|
const { ANY } = Comparator
|
||||||
const satisfies = __webpack_require__(6055)
|
const satisfies = __webpack_require__(6055)
|
||||||
const compare = __webpack_require__(4309)
|
const compare = __webpack_require__(4309)
|
||||||
|
|
||||||
// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
|
// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
|
||||||
// - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...`
|
// - Every simple range `r1, r2, ...` is a null set, OR
|
||||||
|
// - Every simple range `r1, r2, ...` which is not a null set is a subset of
|
||||||
|
// some `R1, R2, ...`
|
||||||
//
|
//
|
||||||
// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
|
// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
|
||||||
// - If c is only the ANY comparator
|
// - If c is only the ANY comparator
|
||||||
// - If C is only the ANY comparator, return true
|
// - If C is only the ANY comparator, return true
|
||||||
// - Else return false
|
// - Else if in prerelease mode, return false
|
||||||
|
// - else replace c with `[>=0.0.0]`
|
||||||
|
// - If C is only the ANY comparator
|
||||||
|
// - if in prerelease mode, return true
|
||||||
|
// - else replace C with `[>=0.0.0]`
|
||||||
// - Let EQ be the set of = comparators in c
|
// - Let EQ be the set of = comparators in c
|
||||||
// - If EQ is more than one, return true (null set)
|
// - If EQ is more than one, return true (null set)
|
||||||
// - Let GT be the highest > or >= comparator in c
|
// - Let GT be the highest > or >= comparator in c
|
||||||
// - Let LT be the lowest < or <= comparator in c
|
// - Let LT be the lowest < or <= comparator in c
|
||||||
// - If GT and LT, and GT.semver > LT.semver, return true (null set)
|
// - If GT and LT, and GT.semver > LT.semver, return true (null set)
|
||||||
|
// - If any C is a = range, and GT or LT are set, return false
|
||||||
// - If EQ
|
// - If EQ
|
||||||
// - If GT, and EQ does not satisfy GT, return true (null set)
|
// - If GT, and EQ does not satisfy GT, return true (null set)
|
||||||
// - If LT, and EQ does not satisfy LT, return true (null set)
|
// - If LT, and EQ does not satisfy LT, return true (null set)
|
||||||
@@ -20895,13 +20968,16 @@ const compare = __webpack_require__(4309)
|
|||||||
// - If GT
|
// - If GT
|
||||||
// - If GT.semver is lower than any > or >= comp in C, return false
|
// - If GT.semver is lower than any > or >= comp in C, return false
|
||||||
// - If GT is >=, and GT.semver does not satisfy every C, return false
|
// - If GT is >=, and GT.semver does not satisfy every C, return false
|
||||||
|
// - If GT.semver has a prerelease, and not in prerelease mode
|
||||||
|
// - If no C has a prerelease and the GT.semver tuple, return false
|
||||||
// - If LT
|
// - If LT
|
||||||
// - If LT.semver is greater than any < or <= comp in C, return false
|
// - If LT.semver is greater than any < or <= comp in C, return false
|
||||||
// - If LT is <=, and LT.semver does not satisfy every C, return false
|
// - If LT is <=, and LT.semver does not satisfy every C, return false
|
||||||
// - If any C is a = range, and GT or LT are set, return false
|
// - If GT.semver has a prerelease, and not in prerelease mode
|
||||||
|
// - If no C has a prerelease and the LT.semver tuple, return false
|
||||||
// - Else return true
|
// - Else return true
|
||||||
|
|
||||||
const subset = (sub, dom, options) => {
|
const subset = (sub, dom, options = {}) => {
|
||||||
if (sub === dom)
|
if (sub === dom)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
@@ -20930,8 +21006,21 @@ const simpleSubset = (sub, dom, options) => {
|
|||||||
if (sub === dom)
|
if (sub === dom)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
if (sub.length === 1 && sub[0].semver === ANY)
|
if (sub.length === 1 && sub[0].semver === ANY) {
|
||||||
return dom.length === 1 && dom[0].semver === ANY
|
if (dom.length === 1 && dom[0].semver === ANY)
|
||||||
|
return true
|
||||||
|
else if (options.includePrerelease)
|
||||||
|
sub = [ new Comparator('>=0.0.0-0') ]
|
||||||
|
else
|
||||||
|
sub = [ new Comparator('>=0.0.0') ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
||||||
|
if (options.includePrerelease)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
dom = [ new Comparator('>=0.0.0') ]
|
||||||
|
}
|
||||||
|
|
||||||
const eqSet = new Set()
|
const eqSet = new Set()
|
||||||
let gt, lt
|
let gt, lt
|
||||||
@@ -20974,10 +21063,32 @@ const simpleSubset = (sub, dom, options) => {
|
|||||||
|
|
||||||
let higher, lower
|
let higher, lower
|
||||||
let hasDomLT, hasDomGT
|
let hasDomLT, hasDomGT
|
||||||
|
// if the subset has a prerelease, we need a comparator in the superset
|
||||||
|
// with the same tuple and a prerelease, or it's not a subset
|
||||||
|
let needDomLTPre = lt &&
|
||||||
|
!options.includePrerelease &&
|
||||||
|
lt.semver.prerelease.length ? lt.semver : false
|
||||||
|
let needDomGTPre = gt &&
|
||||||
|
!options.includePrerelease &&
|
||||||
|
gt.semver.prerelease.length ? gt.semver : false
|
||||||
|
// exception: <1.2.3-0 is the same as <1.2.3
|
||||||
|
if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
|
||||||
|
lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
|
||||||
|
needDomLTPre = false
|
||||||
|
}
|
||||||
|
|
||||||
for (const c of dom) {
|
for (const c of dom) {
|
||||||
hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
|
hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
|
||||||
hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
|
hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
|
||||||
if (gt) {
|
if (gt) {
|
||||||
|
if (needDomGTPre) {
|
||||||
|
if (c.semver.prerelease && c.semver.prerelease.length &&
|
||||||
|
c.semver.major === needDomGTPre.major &&
|
||||||
|
c.semver.minor === needDomGTPre.minor &&
|
||||||
|
c.semver.patch === needDomGTPre.patch) {
|
||||||
|
needDomGTPre = false
|
||||||
|
}
|
||||||
|
}
|
||||||
if (c.operator === '>' || c.operator === '>=') {
|
if (c.operator === '>' || c.operator === '>=') {
|
||||||
higher = higherGT(gt, c, options)
|
higher = higherGT(gt, c, options)
|
||||||
if (higher === c && higher !== gt)
|
if (higher === c && higher !== gt)
|
||||||
@@ -20986,6 +21097,14 @@ const simpleSubset = (sub, dom, options) => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (lt) {
|
if (lt) {
|
||||||
|
if (needDomLTPre) {
|
||||||
|
if (c.semver.prerelease && c.semver.prerelease.length &&
|
||||||
|
c.semver.major === needDomLTPre.major &&
|
||||||
|
c.semver.minor === needDomLTPre.minor &&
|
||||||
|
c.semver.patch === needDomLTPre.patch) {
|
||||||
|
needDomLTPre = false
|
||||||
|
}
|
||||||
|
}
|
||||||
if (c.operator === '<' || c.operator === '<=') {
|
if (c.operator === '<' || c.operator === '<=') {
|
||||||
lower = lowerLT(lt, c, options)
|
lower = lowerLT(lt, c, options)
|
||||||
if (lower === c && lower !== lt)
|
if (lower === c && lower !== lt)
|
||||||
@@ -21006,6 +21125,12 @@ const simpleSubset = (sub, dom, options) => {
|
|||||||
if (lt && hasDomGT && !gt && gtltComp !== 0)
|
if (lt && hasDomGT && !gt && gtltComp !== 0)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
// we needed a prerelease range in a specific tuple, but didn't get one
|
||||||
|
// then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
|
||||||
|
// because it includes prereleases in the 1.2.3 tuple
|
||||||
|
if (needDomGTPre || needDomLTPre)
|
||||||
|
return false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,54 +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 "dockerfile" {
|
|
||||||
dockerfile = "dev.Dockerfile"
|
|
||||||
}
|
|
||||||
|
|
||||||
target "update-yarn" {
|
|
||||||
inherits = ["dockerfile"]
|
|
||||||
target = "update-yarn"
|
|
||||||
output = ["."]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build" {
|
target "build" {
|
||||||
inherits = ["dockerfile"]
|
inherits = ["node-version"]
|
||||||
target = "dist"
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "build-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "test" {
|
target "build-validate" {
|
||||||
inherits = ["dockerfile"]
|
inherits = ["node-version"]
|
||||||
target = "test-coverage"
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
output = ["."]
|
target = "build-validate"
|
||||||
}
|
}
|
||||||
|
|
||||||
target "format" {
|
target "format" {
|
||||||
inherits = ["dockerfile"]
|
inherits = ["node-version"]
|
||||||
target = "format"
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "format-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-format" {
|
target "format-validate" {
|
||||||
inherits = ["dockerfile"]
|
inherits = ["node-version"]
|
||||||
target = "validate-format"
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "format-validate"
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-build" {
|
target "vendor-update" {
|
||||||
inherits = ["dockerfile"]
|
inherits = ["node-version"]
|
||||||
target = "validate-build"
|
dockerfile = "./hack/vendor.Dockerfile"
|
||||||
|
target = "update"
|
||||||
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-yarn" {
|
target "vendor-validate" {
|
||||||
inherits = ["dockerfile"]
|
inherits = ["node-version"]
|
||||||
target = "validate-yarn"
|
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
|
@@ -28,7 +28,7 @@
|
|||||||
"csv-parse": "^4.15.3",
|
"csv-parse": "^4.15.3",
|
||||||
"handlebars": "^4.7.7",
|
"handlebars": "^4.7.7",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"semver": "^7.3.4"
|
"semver": "^7.3.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.0",
|
"@types/jest": "^26.0.0",
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
export interface Flavor {
|
export interface Flavor {
|
||||||
latest: string;
|
latest: string;
|
||||||
prefix: string;
|
prefix: string;
|
||||||
@@ -38,5 +40,11 @@ export function Transform(inputs: string[]): Flavor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.startGroup(`Processing flavor input`);
|
||||||
|
core.info(`latest=${flavor.latest}`);
|
||||||
|
core.info(`prefix=${flavor.prefix}`);
|
||||||
|
core.info(`suffix=${flavor.suffix}`);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
return flavor;
|
return flavor;
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,9 @@ export class Meta {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (const tag of this.tags) {
|
for (const tag of this.tags) {
|
||||||
|
if (tag.attrs['enable'] == 'false') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (tag.type) {
|
switch (tag.type) {
|
||||||
case tcl.Type.Schedule: {
|
case tcl.Type.Schedule: {
|
||||||
version = this.procSchedule(version, tag);
|
version = this.procSchedule(version, tag);
|
||||||
|
35
src/tag.ts
35
src/tag.ts
@@ -1,4 +1,5 @@
|
|||||||
import csvparse from 'csv-parse/lib/sync';
|
import csvparse from 'csv-parse/lib/sync';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
export enum Type {
|
export enum Type {
|
||||||
Schedule = 'schedule',
|
Schedule = 'schedule',
|
||||||
@@ -16,9 +17,21 @@ export enum RefEvent {
|
|||||||
PR = 'pr'
|
PR = 'pr'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Tag {
|
export class Tag {
|
||||||
type: Type;
|
public type?: Type;
|
||||||
attrs: Record<string, string>;
|
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> = {
|
export const DefaultPriorities: Record<Type, string> = {
|
||||||
@@ -42,10 +55,11 @@ export function Transform(inputs: string[]): Tag[] {
|
|||||||
`type=ref,event=${RefEvent.PR}`
|
`type=ref,event=${RefEvent.PR}`
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const input of inputs) {
|
for (const input of inputs) {
|
||||||
tags.push(Parse(input));
|
tags.push(Parse(input));
|
||||||
}
|
}
|
||||||
return tags.sort((tag1, tag2) => {
|
const sorted = tags.sort((tag1, tag2) => {
|
||||||
if (Number(tag1.attrs['priority']) < Number(tag2.attrs['priority'])) {
|
if (Number(tag1.attrs['priority']) < Number(tag2.attrs['priority'])) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -54,6 +68,14 @@ export function Transform(inputs: string[]): Tag[] {
|
|||||||
}
|
}
|
||||||
return 0;
|
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 {
|
export function Parse(s: string): Tag {
|
||||||
@@ -62,10 +84,7 @@ export function Parse(s: string): Tag {
|
|||||||
skipLinesWithEmptyValues: true
|
skipLinesWithEmptyValues: true
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
const tag = {
|
const tag = new Tag();
|
||||||
attrs: {}
|
|
||||||
} as Tag;
|
|
||||||
|
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
const parts = field.toString().split('=', 2);
|
const parts = field.toString().split('=', 2);
|
||||||
if (parts.length == 1) {
|
if (parts.length == 1) {
|
||||||
|
14
yarn.lock
14
yarn.lock
@@ -3175,10 +3175,10 @@ 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.3.4:
|
semver@7.x, semver@^7.3.2, semver@^7.3.5:
|
||||||
version "7.3.4"
|
version "7.3.5"
|
||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97"
|
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
|
||||||
integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==
|
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
lru-cache "^6.0.0"
|
lru-cache "^6.0.0"
|
||||||
|
|
||||||
@@ -3818,9 +3818,9 @@ 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.0"
|
version "4.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
|
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
|
||||||
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
|
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==
|
||||||
|
|
||||||
yallist@^4.0.0:
|
yallist@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
|
Reference in New Issue
Block a user