mirror of
https://github.com/elgohr/Publish-Docker-Github-Action.git
synced 2026-03-12 18:07:12 -04:00
⬆️ Remove backward compatibility for set-output
See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
This commit is contained in:
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -87,5 +87,5 @@ jobs:
|
||||
run: |
|
||||
git config --global user.email "no_reply@gohr.digital"
|
||||
git config --global user.name "Release Bot"
|
||||
git tag -fa v4 -m "Update v4 tag"
|
||||
git push origin v4 --force
|
||||
git tag -fa v5 -m "Update v5 tag"
|
||||
git push origin v5 --force
|
||||
|
||||
14
README.md
14
README.md
@@ -16,7 +16,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@v4
|
||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||
with:
|
||||
name: myDocker/repository
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
@@ -125,7 +125,7 @@ All `buildargs` will be masked, so that they don't appear in the logs.
|
||||
|
||||
```yaml
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@v4
|
||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||
env:
|
||||
MY_FIRST: variableContent
|
||||
MY_SECOND: variableContent
|
||||
@@ -141,7 +141,7 @@ Use `buildoptions` when you want to configure [options](https://docs.docker.com/
|
||||
|
||||
```yaml
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@v4
|
||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||
with:
|
||||
name: myDocker/repository
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
@@ -159,7 +159,7 @@ Architectures are separated by comma.
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@v4
|
||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||
with:
|
||||
name: myDocker/repository
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
@@ -185,7 +185,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@v4
|
||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||
with:
|
||||
name: myDocker/repository
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
@@ -215,7 +215,7 @@ Use `tags` when you want to bring your own tags (separated by comma).
|
||||
|
||||
```yaml
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@v4
|
||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||
with:
|
||||
name: myDocker/repository
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
@@ -243,7 +243,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Publish to Registry
|
||||
pre: echo ::save-state name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})
|
||||
uses: elgohr/Publish-Docker-Github-Action@v4
|
||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||
with:
|
||||
name: myDocker/repository
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
|
||||
11
SECURITY.md
11
SECURITY.md
@@ -2,11 +2,12 @@
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| v4 | :white_check_mark: |
|
||||
| main | :white_check_mark: |
|
||||
| master | :x: |
|
||||
| Version | Supported |
|
||||
| ------- | ---------------------------------------- |
|
||||
| v5 | :white_check_mark: |
|
||||
| v4 | :white_check_mark: (until 31st May 2023) |
|
||||
| main | :white_check_mark: |
|
||||
| master | :x: |
|
||||
|
||||
Master has been deprecated (https://github.com/elgohr/Publish-Docker-Github-Action/commit/8217e91c0369a5342a4ef2d612de87492410a666) but will stay, so that it will not break peoples pipelines.
|
||||
|
||||
|
||||
@@ -66,14 +66,12 @@ main() {
|
||||
push
|
||||
fi
|
||||
|
||||
echo "::set-output name=tag::${FIRST_TAG}"
|
||||
echo "tag=${FIRST_TAG}" >> "$GITHUB_OUTPUT"
|
||||
if uses "${INPUT_PLATFORMS}"; then
|
||||
DIGEST=$(jq -r '."containerimage.digest"' metadata.json)
|
||||
else
|
||||
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${DOCKERNAME})
|
||||
fi
|
||||
echo "::set-output name=digest::${DIGEST}"
|
||||
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
docker logout
|
||||
@@ -184,7 +182,6 @@ useSnapshot() {
|
||||
local SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-6)
|
||||
local SNAPSHOT_TAG="${TIMESTAMP}${SHORT_SHA}"
|
||||
TAGS="${TAGS} ${SNAPSHOT_TAG}"
|
||||
echo "::set-output name=snapshot-tag::${SNAPSHOT_TAG}"
|
||||
echo "snapshot-tag=${SNAPSHOT_TAG}" >> "$GITHUB_OUTPUT"
|
||||
}
|
||||
|
||||
|
||||
3
makefile
3
makefile
@@ -1,2 +1,5 @@
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
DOCKER_BUILDKIT=0# to prevent caching of test results
|
||||
|
||||
test:
|
||||
docker build .
|
||||
32
test.bats
32
test.bats
@@ -36,7 +36,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker login -u USERNAME --password-stdin
|
||||
@@ -51,7 +50,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker login -u USERNAME --password-stdin
|
||||
@@ -66,7 +64,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::myBranch"
|
||||
expectGitHubOutputContains "tag=myBranch"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -t my/repository:myBranch .
|
||||
@@ -78,7 +75,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::myBranch-withDash"
|
||||
expectGitHubOutputContains "tag=myBranch-withDash"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -t my/repository:myBranch-withDash .
|
||||
@@ -90,7 +86,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker login -u USERNAME --password-stdin
|
||||
@@ -106,7 +101,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::myRelease"
|
||||
expectGitHubOutputContains "tag=myRelease"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -t my/repository:myRelease .
|
||||
@@ -119,7 +113,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -t my/repository:latest .
|
||||
@@ -132,7 +125,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::1.2.3"
|
||||
expectGitHubOutputContains "tag=1.2.3"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker login -u USERNAME --password-stdin
|
||||
@@ -150,7 +142,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::12.345.5678"
|
||||
expectGitHubOutputContains "tag=12.345.5678"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker login -u USERNAME --password-stdin
|
||||
@@ -174,7 +165,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::1.1.1-${SUFFIX}"
|
||||
expectGitHubOutputContains "tag=1.1.1-${SUFFIX}"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker login -u USERNAME --password-stdin
|
||||
@@ -191,7 +181,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::1.2.34"
|
||||
expectGitHubOutputContains "tag=1.2.34"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker login -u USERNAME --password-stdin
|
||||
@@ -209,7 +198,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -t my/repository:latest .
|
||||
@@ -222,7 +210,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -t my/repository:latest .
|
||||
@@ -234,7 +221,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh export GITHUB_REF='refs/heads/master'
|
||||
|
||||
expectStdOutContains "::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -f MyDockerFileName -t my/repository:latest .
|
||||
@@ -252,9 +238,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "
|
||||
::set-output name=snapshot-tag::19700101010112169e
|
||||
::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "snapshot-tag=19700101010112169etag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/date +%Y%m%d%H%M%S
|
||||
@@ -274,8 +257,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "
|
||||
::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -t my/repository:latest .
|
||||
@@ -425,8 +406,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "
|
||||
::set-output name=tag::12169ed809255604e557a82617264e9c373faca7"
|
||||
expectGitHubOutputContains "tag=12169ed809255604e557a82617264e9c373faca7"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -t my/repository:12169ed809255604e557a82617264e9c373faca7 .
|
||||
@@ -438,8 +417,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "
|
||||
::set-output name=tag::custom-tag"
|
||||
expectGitHubOutputContains "tag=custom-tag"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build -t my/repository:custom-tag .
|
||||
@@ -453,8 +430,7 @@ teardown() {
|
||||
|
||||
expectStdOutContains "
|
||||
::add-mask::MY_FIRST
|
||||
::add-mask::MY_SECOND
|
||||
::set-output name=tag::latest"
|
||||
::add-mask::MY_SECOND"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build --build-arg MY_FIRST --build-arg MY_SECOND -t my/repository:latest ."
|
||||
@@ -466,8 +442,7 @@ teardown() {
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "
|
||||
::add-mask::MY_ONLY
|
||||
::set-output name=tag::latest"
|
||||
::add-mask::MY_ONLY"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker build --build-arg MY_ONLY -t my/repository:latest ."
|
||||
@@ -549,7 +524,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=digest::my/repository@sha256:53b76152042486bc741fe59f130bfe683b883060c8284271a2586342f35dcd0e"
|
||||
expectGitHubOutputContains "digest=my/repository@sha256:53b76152042486bc741fe59f130bfe683b883060c8284271a2586342f35dcd0e"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker push my/repository:latest
|
||||
@@ -661,7 +635,6 @@ teardown() {
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::latest"
|
||||
expectGitHubOutputContains "tag=latest"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker login -u USERNAME --password-stdin
|
||||
@@ -715,7 +688,6 @@ EOT
|
||||
|
||||
run /entrypoint.sh
|
||||
|
||||
expectStdOutContains "::set-output name=tag::latest::set-output name=digest::sha256:aa2c7631cc1bbf588192ec7e55b428ad92fe63834200303f28e93444d7fc114a"
|
||||
expectGitHubOutputContains "tag=latestdigest=sha256:aa2c7631cc1bbf588192ec7e55b428ad92fe63834200303f28e93444d7fc114a"
|
||||
|
||||
expectMockCalledContains "/usr/local/mock/docker login -u USERNAME --password-stdin
|
||||
|
||||
Reference in New Issue
Block a user