From 487a8015628d33c09046ffe5ae87a1d7248a45eb Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 13:18:39 -0500 Subject: [PATCH 01/16] Add Version check --- .github/workflows/buildpack-ubuntu2004.yml | 53 ++++++++++++++++------ 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/.github/workflows/buildpack-ubuntu2004.yml b/.github/workflows/buildpack-ubuntu2004.yml index 13453720e231..a13e3eebc2e3 100644 --- a/.github/workflows/buildpack-ubuntu2004.yml +++ b/.github/workflows/buildpack-ubuntu2004.yml @@ -22,19 +22,46 @@ jobs: run: | docker build scripts/docker/${IMAGE_NAME} --file scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT --tag $IMAGE_NAME - - name: Test image + - name: Check version run: | - docker run -v ${PWD}:/tmp -e CI=1 $IMAGE_NAME /tmp/scripts/build.sh - - - name: Push image - run: | - echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin - VERSION=$(docker inspect --format={{.Config.Labels.version}} $IMAGE_NAME) - docker tag $IMAGE_NAME $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:$VERSION - docker push $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:$VERSION - - docker tag $IMAGE_NAME $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:latest - docker push $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:latest + echo "::set-env name=VERSION::$VERSION" + VERSION_EXIST=$(docker pull -q $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:${VERSION} || echo false && true) + if [ "${VERSION_EXIST}" != "false" ] + then + false + fi - docker logout +# - name: Test image +# run: | +# docker run -v ${PWD}:/tmp -e CI=1 $IMAGE_NAME /tmp/scripts/build.sh +# +# - name: Save image +# run: | +# docker save -o $IMAGE_NAME-$IMAGE_VARIANT.tar $IMAGE_NAME +# HASH=$(sha256sum $IMAGE_NAME-$IMAGE_VARIANT.tar | awk '{print $1}') +# mv $IMAGE_NAME-$IMAGE_VARIANT.tar $IMAGE_NAME-$IMAGE_VARIANT-$HASH +# echo "::set-env name=HASH::$HASH" +# echo "::set-env name=ARCHIVE::$IMAGE_NAME-$IMAGE_VARIANT-$HASH" +# +# - name: Upload image +# uses: actions/upload-artifact@v2 +# with: +# name: ${{ env.ARCHIVE }} +# path: ${{ env.ARCHIVE }} +# +# - name: Prepare create release issue action +# uses: actions/setup-node@v1 +# with: +# node-version: "12.x" +# +# - name: Building Action +# run: npm i && npm run build +# working-directory: ./.github/actions/create-issue +# +# - name: Create Release Issue +# uses: ./.github/actions/create-issue +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# action-id: ${{ github.run_id }} +# package-version: ${{ env.package_version }} From 22431953901ed48e4f5b4da1b404b519a6a7dc9f Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 13:23:04 -0500 Subject: [PATCH 02/16] Add login & logout. --- .github/workflows/buildpack-ubuntu2004.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/buildpack-ubuntu2004.yml b/.github/workflows/buildpack-ubuntu2004.yml index a13e3eebc2e3..8756c25b8535 100644 --- a/.github/workflows/buildpack-ubuntu2004.yml +++ b/.github/workflows/buildpack-ubuntu2004.yml @@ -24,7 +24,9 @@ jobs: - name: Check version run: | + echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin VERSION=$(docker inspect --format={{.Config.Labels.version}} $IMAGE_NAME) + docker logout echo "::set-env name=VERSION::$VERSION" VERSION_EXIST=$(docker pull -q $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:${VERSION} || echo false && true) if [ "${VERSION_EXIST}" != "false" ] From 10982eceaa30e4622f118976032c279a13ed9513 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 13:32:17 -0500 Subject: [PATCH 03/16] Add error message. --- .github/workflows/buildpack-ubuntu2004.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildpack-ubuntu2004.yml b/.github/workflows/buildpack-ubuntu2004.yml index 8756c25b8535..77e93e546f63 100644 --- a/.github/workflows/buildpack-ubuntu2004.yml +++ b/.github/workflows/buildpack-ubuntu2004.yml @@ -22,15 +22,19 @@ jobs: run: | docker build scripts/docker/${IMAGE_NAME} --file scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT --tag $IMAGE_NAME + - name: Docker login + run: echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin + - name: Check version run: | - echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin VERSION=$(docker inspect --format={{.Config.Labels.version}} $IMAGE_NAME) - docker logout echo "::set-env name=VERSION::$VERSION" VERSION_EXIST=$(docker pull -q $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:${VERSION} || echo false && true) if [ "${VERSION_EXIST}" != "false" ] then + echo "" + echo "ERROR: Version ${VERSION} already exist for '$IMAGE_NAME-$IMAGE_VARIANT'. Aborting." + echo "" false fi From 66e9b498733f7456669ed70754b95bce3cb536a6 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 14:05:30 -0500 Subject: [PATCH 04/16] Remove docker build dependency from version check. --- .github/workflows/buildpack-ubuntu2004.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/buildpack-ubuntu2004.yml b/.github/workflows/buildpack-ubuntu2004.yml index 77e93e546f63..ca61aa2f2406 100644 --- a/.github/workflows/buildpack-ubuntu2004.yml +++ b/.github/workflows/buildpack-ubuntu2004.yml @@ -18,26 +18,28 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Build image - run: | - docker build scripts/docker/${IMAGE_NAME} --file scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT --tag $IMAGE_NAME - - - name: Docker login - run: echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin - - name: Check version run: | - VERSION=$(docker inspect --format={{.Config.Labels.version}} $IMAGE_NAME) + VERSION=$(grep "LABEL version" scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT | awk -F'"' '$0=$2') echo "::set-env name=VERSION::$VERSION" + + echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin VERSION_EXIST=$(docker pull -q $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:${VERSION} || echo false && true) + docker logout docker.pkg.github.com + if [ "${VERSION_EXIST}" != "false" ] then echo "" - echo "ERROR: Version ${VERSION} already exist for '$IMAGE_NAME-$IMAGE_VARIANT'. Aborting." + echo "ERROR: version '${VERSION}' already exist for '$IMAGE_NAME-$IMAGE_VARIANT'. Aborting." echo "" + false fi + - name: Build image + run: | + docker build scripts/docker/${IMAGE_NAME} --file scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT --tag $IMAGE_NAME + # - name: Test image # run: | # docker run -v ${PWD}:/tmp -e CI=1 $IMAGE_NAME /tmp/scripts/build.sh From 4ab96437ceccab5948cf099b447c0f857575cecc Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 14:40:51 -0500 Subject: [PATCH 05/16] Add create issue action. --- .github/actions/create-issue/action.yml | 33 ++ .../actions/create-issue/package-lock.json | 394 ++++++++++++++++++ .github/actions/create-issue/package.json | 20 + .github/actions/create-issue/src/index.ts | 38 ++ .github/actions/create-issue/tsconfig.json | 10 + .github/workflows/buildpack-ubuntu2004.yml | 94 +++-- 6 files changed, 543 insertions(+), 46 deletions(-) create mode 100644 .github/actions/create-issue/action.yml create mode 100644 .github/actions/create-issue/package-lock.json create mode 100644 .github/actions/create-issue/package.json create mode 100644 .github/actions/create-issue/src/index.ts create mode 100644 .github/actions/create-issue/tsconfig.json diff --git a/.github/actions/create-issue/action.yml b/.github/actions/create-issue/action.yml new file mode 100644 index 000000000000..bce6df640e46 --- /dev/null +++ b/.github/actions/create-issue/action.yml @@ -0,0 +1,33 @@ +name: "Create GitHub Issue" +description: "Creates a GitHub issue" +inputs: + token: + description: "GitHub access token" + required: true + default: "" + action-id: + description: "GitHub Action ID" + required: true + default: "" + title: + description: "Title of the issue" + required: true + default: "Title" + artifact: + description: "Name of the artifact" + required: true + default: "Something like buildpack-ubuntu2004-d12f0d12c9f69baa7b825033b2f9c89acea738bf1ae734efa4b343833f897e1d" + package-name: + description: "Name of the package being released" + required: true + default: "Something like buildpack-ubuntu2004" + package-version: + description: "Version of the package being released" + required: true + default: "Something like 1.0.0" +outputs: + issue-id: + description: "ID of the created issue on GitHub" +runs: + using: "node12" + main: "dist/index.js" diff --git a/.github/actions/create-issue/package-lock.json b/.github/actions/create-issue/package-lock.json new file mode 100644 index 000000000000..bac7104df959 --- /dev/null +++ b/.github/actions/create-issue/package-lock.json @@ -0,0 +1,394 @@ +{ + "name": "create-issue", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@actions/core": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz", + "integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w==" + }, + "@actions/github": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-2.1.1.tgz", + "integrity": "sha512-kAgTGUx7yf5KQCndVeHSwCNZuDBvPyxm5xKTswW2lofugeuC1AZX73nUUVDNaysnM9aKFMHv9YCdVJbg7syEyA==", + "requires": { + "@actions/http-client": "^1.0.3", + "@octokit/graphql": "^4.3.1", + "@octokit/rest": "^16.43.1" + } + }, + "@actions/http-client": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz", + "integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==", + "requires": { + "tunnel": "0.0.6" + } + }, + "@octokit/auth-token": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.0.tgz", + "integrity": "sha512-eoOVMjILna7FVQf96iWc3+ZtE/ZT6y8ob8ZzcqKY1ibSQCnu4O/B7pJvzMx5cyZ/RjAff6DAdEb0O0Cjcxidkg==", + "requires": { + "@octokit/types": "^2.0.0" + } + }, + "@octokit/endpoint": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.5.3.tgz", + "integrity": "sha512-EzKwkwcxeegYYah5ukEeAI/gYRLv2Y9U5PpIsseGSFDk+G3RbipQGBs8GuYS1TLCtQaqoO66+aQGtITPalxsNQ==", + "requires": { + "@octokit/types": "^2.0.0", + "is-plain-object": "^3.0.0", + "universal-user-agent": "^5.0.0" + }, + "dependencies": { + "universal-user-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-5.0.0.tgz", + "integrity": "sha512-B5TPtzZleXyPrUMKCpEHFmVhMN6EhmJYjG5PQna9s7mXeSqGTLap4OpqLl5FCEFUI3UBmllkETwKf/db66Y54Q==", + "requires": { + "os-name": "^3.1.0" + } + } + } + }, + "@octokit/graphql": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.3.1.tgz", + "integrity": "sha512-hCdTjfvrK+ilU2keAdqNBWOk+gm1kai1ZcdjRfB30oA3/T6n53UVJb7w0L5cR3/rhU91xT3HSqCd+qbvH06yxA==", + "requires": { + "@octokit/request": "^5.3.0", + "@octokit/types": "^2.0.0", + "universal-user-agent": "^4.0.0" + } + }, + "@octokit/plugin-paginate-rest": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz", + "integrity": "sha512-jbsSoi5Q1pj63sC16XIUboklNw+8tL9VOnJsWycWYR78TKss5PVpIPb1TUUcMQ+bBh7cY579cVAWmf5qG+dw+Q==", + "requires": { + "@octokit/types": "^2.0.1" + } + }, + "@octokit/plugin-request-log": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.0.tgz", + "integrity": "sha512-ywoxP68aOT3zHCLgWZgwUJatiENeHE7xJzYjfz8WI0goynp96wETBF+d95b8g/uL4QmS6owPVlaxiz3wyMAzcw==" + }, + "@octokit/plugin-rest-endpoint-methods": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-2.4.0.tgz", + "integrity": "sha512-EZi/AWhtkdfAYi01obpX0DF7U6b1VRr30QNQ5xSFPITMdLSfhcBqjamE3F+sKcxPbD7eZuMHu3Qkk2V+JGxBDQ==", + "requires": { + "@octokit/types": "^2.0.1", + "deprecation": "^2.3.1" + } + }, + "@octokit/request": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.3.2.tgz", + "integrity": "sha512-7NPJpg19wVQy1cs2xqXjjRq/RmtSomja/VSWnptfYwuBxLdbYh2UjhGi0Wx7B1v5Iw5GKhfFDQL7jM7SSp7K2g==", + "requires": { + "@octokit/endpoint": "^5.5.0", + "@octokit/request-error": "^1.0.1", + "@octokit/types": "^2.0.0", + "deprecation": "^2.0.0", + "is-plain-object": "^3.0.0", + "node-fetch": "^2.3.0", + "once": "^1.4.0", + "universal-user-agent": "^5.0.0" + }, + "dependencies": { + "universal-user-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-5.0.0.tgz", + "integrity": "sha512-B5TPtzZleXyPrUMKCpEHFmVhMN6EhmJYjG5PQna9s7mXeSqGTLap4OpqLl5FCEFUI3UBmllkETwKf/db66Y54Q==", + "requires": { + "os-name": "^3.1.0" + } + } + } + }, + "@octokit/request-error": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.1.tgz", + "integrity": "sha512-+6yDyk1EES6WK+l3viRDElw96MvwfJxCt45GvmjDUKWjYIb3PJZQkq3i46TwGwoPD4h8NmTrENmtyA1FwbmhRA==", + "requires": { + "@octokit/types": "^2.0.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "@octokit/rest": { + "version": "16.43.1", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.43.1.tgz", + "integrity": "sha512-gfFKwRT/wFxq5qlNjnW2dh+qh74XgTQ2B179UX5K1HYCluioWj8Ndbgqw2PVqa1NnVJkGHp2ovMpVn/DImlmkw==", + "requires": { + "@octokit/auth-token": "^2.4.0", + "@octokit/plugin-paginate-rest": "^1.1.1", + "@octokit/plugin-request-log": "^1.0.0", + "@octokit/plugin-rest-endpoint-methods": "2.4.0", + "@octokit/request": "^5.2.0", + "@octokit/request-error": "^1.0.2", + "atob-lite": "^2.0.0", + "before-after-hook": "^2.0.0", + "btoa-lite": "^1.0.0", + "deprecation": "^2.0.0", + "lodash.get": "^4.4.2", + "lodash.set": "^4.3.2", + "lodash.uniq": "^4.5.0", + "octokit-pagination-methods": "^1.1.0", + "once": "^1.4.0", + "universal-user-agent": "^4.0.0" + } + }, + "@octokit/types": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.5.0.tgz", + "integrity": "sha512-KEnLwOfdXzxPNL34fj508bhi9Z9cStyN7qY1kOfVahmqtAfrWw6Oq3P4R+dtsg0lYtZdWBpUrS/Ixmd5YILSww==", + "requires": { + "@types/node": ">= 8" + } + }, + "@types/node": { + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.0.tgz", + "integrity": "sha512-0ARSQootUG1RljH2HncpsY2TJBfGQIKOOi7kxzUY6z54ePu/ZD+wJA8zI2Q6v8rol2qpG/rvqsReco8zNMPvhQ==" + }, + "atob-lite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", + "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=" + }, + "before-after-hook": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", + "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==" + }, + "btoa-lite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", + "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=" + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "is-plain-object": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz", + "integrity": "sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==", + "requires": { + "isobject": "^4.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz", + "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==" + }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" + }, + "lodash.set": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", + "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" + }, + "macos-release": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz", + "integrity": "sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA==" + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "^2.0.0" + } + }, + "octokit-pagination-methods": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", + "integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "os-name": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", + "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", + "requires": { + "macos-release": "^2.2.0", + "windows-release": "^3.1.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + }, + "tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" + }, + "typescript": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "dev": true + }, + "universal-user-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.1.tgz", + "integrity": "sha512-LnST3ebHwVL2aNe4mejI9IQh2HfZ1RLo8Io2HugSif8ekzD1TlWpHpColOB/eh8JHMLkGH3Akqf040I+4ylNxg==", + "requires": { + "os-name": "^3.1.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "windows-release": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.2.0.tgz", + "integrity": "sha512-QTlz2hKLrdqukrsapKsINzqMgOUpQW268eJ0OaOpJN32h272waxR9fkB9VoWRtK7uKHG5EHJcTXQBD8XZVJkFA==", + "requires": { + "execa": "^1.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/.github/actions/create-issue/package.json b/.github/actions/create-issue/package.json new file mode 100644 index 000000000000..f8e737bced41 --- /dev/null +++ b/.github/actions/create-issue/package.json @@ -0,0 +1,20 @@ +{ + "name": "create-issue", + "version": "1.0.0", + "description": "An action for creating a GitHub issue", + "private": true, + "main": "index.js", + "scripts": { + "build": "tsc" + }, + "keywords": [], + "author": "Aaron Powell", + "license": "MIT", + "dependencies": { + "@actions/core": "^1.2.3", + "@actions/github": "^2.1.1" + }, + "devDependencies": { + "typescript": "^3.8.3" + } +} diff --git a/.github/actions/create-issue/src/index.ts b/.github/actions/create-issue/src/index.ts new file mode 100644 index 000000000000..d90515eaf5c5 --- /dev/null +++ b/.github/actions/create-issue/src/index.ts @@ -0,0 +1,38 @@ +import * as core from "@actions/core"; +import * as github from "@actions/github"; + +async function run() { + const token = core.getInput("token"); + + const octokit = new github.GitHub(token); + const context = github.context; + + const newIssue = await octokit.issues.create({ + ...context.repo, + labels: [`buildpack-review`], + title: `${core.getInput("package-name")} ${core.getInput("package-version")} ready for review`, + body: `# :rocket: ${core.getInput("package-name")} ${core.getInput("package-version")} ready for review` + }); + + await octokit.issues.createComment({ + ...context.repo, + issue_number: newIssue.data.number, + body: `Action: ${core.getInput("action-id")}` + }); + + await octokit.issues.createComment({ + ...context.repo, + issue_number: newIssue.data.number, + body: `Artifact: ${core.getInput("artifact")}` + }); + + await octokit.issues.createComment({ + ...context.repo, + issue_number: newIssue.data.number, + body: `Commit: ${context.sha}` + }); + + core.setOutput("issue-id", newIssue.data.number.toString()); +} + +run(); diff --git a/.github/actions/create-issue/tsconfig.json b/.github/actions/create-issue/tsconfig.json new file mode 100644 index 000000000000..67d94bc92287 --- /dev/null +++ b/.github/actions/create-issue/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "outDir": "dist" + } +} diff --git a/.github/workflows/buildpack-ubuntu2004.yml b/.github/workflows/buildpack-ubuntu2004.yml index ca61aa2f2406..b8ea41aaa798 100644 --- a/.github/workflows/buildpack-ubuntu2004.yml +++ b/.github/workflows/buildpack-ubuntu2004.yml @@ -18,23 +18,23 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Check version - run: | - VERSION=$(grep "LABEL version" scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT | awk -F'"' '$0=$2') - echo "::set-env name=VERSION::$VERSION" - - echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin - VERSION_EXIST=$(docker pull -q $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:${VERSION} || echo false && true) - docker logout docker.pkg.github.com - - if [ "${VERSION_EXIST}" != "false" ] - then - echo "" - echo "ERROR: version '${VERSION}' already exist for '$IMAGE_NAME-$IMAGE_VARIANT'. Aborting." - echo "" - - false - fi +# - name: Check version +# run: | +# VERSION=$(grep "LABEL version" scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT | awk -F'"' '$0=$2') +# echo "::set-env name=VERSION::$VERSION" +# +# echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin +# VERSION_EXIST=$(docker pull -q $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:${VERSION} || echo false && true) +# docker logout docker.pkg.github.com +# +# if [ "${VERSION_EXIST}" != "false" ] +# then +# echo "" +# echo "ERROR: version '${VERSION}' already exist for '$IMAGE_NAME-$IMAGE_VARIANT'. Aborting." +# echo "" +# +# false +# fi - name: Build image run: | @@ -44,32 +44,34 @@ jobs: # run: | # docker run -v ${PWD}:/tmp -e CI=1 $IMAGE_NAME /tmp/scripts/build.sh # -# - name: Save image -# run: | -# docker save -o $IMAGE_NAME-$IMAGE_VARIANT.tar $IMAGE_NAME -# HASH=$(sha256sum $IMAGE_NAME-$IMAGE_VARIANT.tar | awk '{print $1}') -# mv $IMAGE_NAME-$IMAGE_VARIANT.tar $IMAGE_NAME-$IMAGE_VARIANT-$HASH -# echo "::set-env name=HASH::$HASH" -# echo "::set-env name=ARCHIVE::$IMAGE_NAME-$IMAGE_VARIANT-$HASH" -# -# - name: Upload image -# uses: actions/upload-artifact@v2 -# with: -# name: ${{ env.ARCHIVE }} -# path: ${{ env.ARCHIVE }} -# -# - name: Prepare create release issue action -# uses: actions/setup-node@v1 -# with: -# node-version: "12.x" -# -# - name: Building Action -# run: npm i && npm run build -# working-directory: ./.github/actions/create-issue -# -# - name: Create Release Issue -# uses: ./.github/actions/create-issue -# with: -# token: ${{ secrets.GITHUB_TOKEN }} -# action-id: ${{ github.run_id }} -# package-version: ${{ env.package_version }} + - name: Save image + run: | + docker save -o $IMAGE_NAME-$IMAGE_VARIANT.tar $IMAGE_NAME + HASH=$(sha256sum $IMAGE_NAME-$IMAGE_VARIANT.tar | awk '{print $1}') + mv $IMAGE_NAME-$IMAGE_VARIANT.tar $IMAGE_NAME-$IMAGE_VARIANT-$HASH + echo "::set-env name=HASH::$HASH" + echo "::set-env name=ARCHIVE::$IMAGE_NAME-$IMAGE_VARIANT-$HASH" + + - name: Upload image + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ARCHIVE }} + path: ${{ env.ARCHIVE }} + + - name: Prepare create release issue action + uses: actions/setup-node@v1 + with: + node-version: "12.x" + + - name: Building Action + run: npm i && npm run build + working-directory: ./.github/actions/create-issue + + - name: Create Review Issue + uses: ./.github/actions/create-issue + with: + token: ${{ secrets.GITHUB_TOKEN }} + action-id: ${{ github.run_id }} + artifact: ${{ env.ARCHIVE }} + package-name: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_VARIANT }} + package-version: ${{ env.VERSION }} From d9eca8c2d6f254c21749ed7287dfc87b428906c5 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 17:14:36 -0500 Subject: [PATCH 06/16] Test review comment on PR. --- .github/actions/create-issue/src/index.ts | 46 +++++++++++++---------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/.github/actions/create-issue/src/index.ts b/.github/actions/create-issue/src/index.ts index d90515eaf5c5..4b62132fb3d3 100644 --- a/.github/actions/create-issue/src/index.ts +++ b/.github/actions/create-issue/src/index.ts @@ -7,32 +7,38 @@ async function run() { const octokit = new github.GitHub(token); const context = github.context; - const newIssue = await octokit.issues.create({ - ...context.repo, - labels: [`buildpack-review`], - title: `${core.getInput("package-name")} ${core.getInput("package-version")} ready for review`, - body: `# :rocket: ${core.getInput("package-name")} ${core.getInput("package-version")} ready for review` - }); - - await octokit.issues.createComment({ - ...context.repo, - issue_number: newIssue.data.number, - body: `Action: ${core.getInput("action-id")}` - }); + // const newIssue = await octokit.issues.create({ + // ...context.repo, + // labels: [`buildpack-review`], + // title: `${core.getInput("package-name")} ${core.getInput("package-version")} ready for review`, + // body: `# :rocket: ${core.getInput("package-name")} ${core.getInput("package-version")} ready for review` + // }); + + // await octokit.issues.createComment({ + // ...context.repo, + // issue_number: newIssue.data.number, + // body: `Action: ${core.getInput("action-id")}` + // }); await octokit.issues.createComment({ ...context.repo, - issue_number: newIssue.data.number, + issue_number: context.payload.pull_request!.number, body: `Artifact: ${core.getInput("artifact")}` }); - await octokit.issues.createComment({ - ...context.repo, - issue_number: newIssue.data.number, - body: `Commit: ${context.sha}` - }); - - core.setOutput("issue-id", newIssue.data.number.toString()); + // await octokit.issues.createComment({ + // ...context.repo, + // issue_number: newIssue.data.number, + // body: `Artifact: ${core.getInput("artifact")}` + // }); + // + // await octokit.issues.createComment({ + // ...context.repo, + // issue_number: newIssue.data.number, + // body: `Commit: ${context.sha}` + // }); + // + // core.setOutput("issue-id", newIssue.data.number.toString()); } run(); From da884d08d7a4cc64dc0e848a95038aa489f35809 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 17:37:42 -0500 Subject: [PATCH 07/16] Update --- .github/actions/create-issue/src/index.ts | 29 +++-------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/.github/actions/create-issue/src/index.ts b/.github/actions/create-issue/src/index.ts index 4b62132fb3d3..651a9e30940f 100644 --- a/.github/actions/create-issue/src/index.ts +++ b/.github/actions/create-issue/src/index.ts @@ -7,37 +7,14 @@ async function run() { const octokit = new github.GitHub(token); const context = github.context; - // const newIssue = await octokit.issues.create({ - // ...context.repo, - // labels: [`buildpack-review`], - // title: `${core.getInput("package-name")} ${core.getInput("package-version")} ready for review`, - // body: `# :rocket: ${core.getInput("package-name")} ${core.getInput("package-version")} ready for review` - // }); - - // await octokit.issues.createComment({ - // ...context.repo, - // issue_number: newIssue.data.number, - // body: `Action: ${core.getInput("action-id")}` - // }); - await octokit.issues.createComment({ ...context.repo, issue_number: context.payload.pull_request!.number, - body: `Artifact: ${core.getInput("artifact")}` + body: `Action: ${core.getInput("action-id")}\n`+ + `Artifact: ${core.getInput("artifact")}\n`+ + `Commit: ${context.sha}` }); - // await octokit.issues.createComment({ - // ...context.repo, - // issue_number: newIssue.data.number, - // body: `Artifact: ${core.getInput("artifact")}` - // }); - // - // await octokit.issues.createComment({ - // ...context.repo, - // issue_number: newIssue.data.number, - // body: `Commit: ${context.sha}` - // }); - // // core.setOutput("issue-id", newIssue.data.number.toString()); } From 4cf50aaa652c5248cd806a0bc5df808d75747ea8 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 17:47:26 -0500 Subject: [PATCH 08/16] buildpack-pr-comment action --- .../actions/buildpack-pr-comment/action.yml | 18 ++++++++++ .../package-lock.json | 8 ++--- .../package.json | 8 ++--- .../src/index.ts | 2 -- .../tsconfig.json | 0 .github/actions/create-issue/action.yml | 33 ------------------- .github/workflows/buildpack-ubuntu2004.yml | 4 +-- 7 files changed, 28 insertions(+), 45 deletions(-) create mode 100644 .github/actions/buildpack-pr-comment/action.yml rename .github/actions/{create-issue => buildpack-pr-comment}/package-lock.json (98%) rename .github/actions/{create-issue => buildpack-pr-comment}/package.json (57%) rename .github/actions/{create-issue => buildpack-pr-comment}/src/index.ts (88%) rename .github/actions/{create-issue => buildpack-pr-comment}/tsconfig.json (100%) delete mode 100644 .github/actions/create-issue/action.yml diff --git a/.github/actions/buildpack-pr-comment/action.yml b/.github/actions/buildpack-pr-comment/action.yml new file mode 100644 index 000000000000..adb906b15a6a --- /dev/null +++ b/.github/actions/buildpack-pr-comment/action.yml @@ -0,0 +1,18 @@ +name: "Add comment to current PR" +description: "Adds a comment to current PR" +inputs: + token: + description: "GitHub access token" + required: true + default: "" + action-id: + description: "GitHub Action ID" + required: true + default: "" + artifact: + description: "Name of the artifact" + required: true + default: "Something like buildpack-ubuntu2004-d12f0d12c9f69baa7b825033b2f9c89acea738bf1ae734efa4b343833f897e1d" +runs: + using: "node12" + main: "dist/index.js" diff --git a/.github/actions/create-issue/package-lock.json b/.github/actions/buildpack-pr-comment/package-lock.json similarity index 98% rename from .github/actions/create-issue/package-lock.json rename to .github/actions/buildpack-pr-comment/package-lock.json index bac7104df959..c086e4c752e3 100644 --- a/.github/actions/create-issue/package-lock.json +++ b/.github/actions/buildpack-pr-comment/package-lock.json @@ -1,13 +1,13 @@ { - "name": "create-issue", + "name": "buildpack-pr-comment", "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@actions/core": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz", - "integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w==" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz", + "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==" }, "@actions/github": { "version": "2.1.1", diff --git a/.github/actions/create-issue/package.json b/.github/actions/buildpack-pr-comment/package.json similarity index 57% rename from .github/actions/create-issue/package.json rename to .github/actions/buildpack-pr-comment/package.json index f8e737bced41..2fe39af632f1 100644 --- a/.github/actions/create-issue/package.json +++ b/.github/actions/buildpack-pr-comment/package.json @@ -1,17 +1,17 @@ { - "name": "create-issue", + "name": "buildpack-pr-comment", "version": "1.0.0", - "description": "An action for creating a GitHub issue", + "description": "An action for creating a comment on current PR to save artifact information", "private": true, "main": "index.js", "scripts": { "build": "tsc" }, "keywords": [], - "author": "Aaron Powell", + "author": "Alexander Arlt", "license": "MIT", "dependencies": { - "@actions/core": "^1.2.3", + "@actions/core": "^1.2.4", "@actions/github": "^2.1.1" }, "devDependencies": { diff --git a/.github/actions/create-issue/src/index.ts b/.github/actions/buildpack-pr-comment/src/index.ts similarity index 88% rename from .github/actions/create-issue/src/index.ts rename to .github/actions/buildpack-pr-comment/src/index.ts index 651a9e30940f..0b2b0a8a0cfc 100644 --- a/.github/actions/create-issue/src/index.ts +++ b/.github/actions/buildpack-pr-comment/src/index.ts @@ -14,8 +14,6 @@ async function run() { `Artifact: ${core.getInput("artifact")}\n`+ `Commit: ${context.sha}` }); - - // core.setOutput("issue-id", newIssue.data.number.toString()); } run(); diff --git a/.github/actions/create-issue/tsconfig.json b/.github/actions/buildpack-pr-comment/tsconfig.json similarity index 100% rename from .github/actions/create-issue/tsconfig.json rename to .github/actions/buildpack-pr-comment/tsconfig.json diff --git a/.github/actions/create-issue/action.yml b/.github/actions/create-issue/action.yml deleted file mode 100644 index bce6df640e46..000000000000 --- a/.github/actions/create-issue/action.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "Create GitHub Issue" -description: "Creates a GitHub issue" -inputs: - token: - description: "GitHub access token" - required: true - default: "" - action-id: - description: "GitHub Action ID" - required: true - default: "" - title: - description: "Title of the issue" - required: true - default: "Title" - artifact: - description: "Name of the artifact" - required: true - default: "Something like buildpack-ubuntu2004-d12f0d12c9f69baa7b825033b2f9c89acea738bf1ae734efa4b343833f897e1d" - package-name: - description: "Name of the package being released" - required: true - default: "Something like buildpack-ubuntu2004" - package-version: - description: "Version of the package being released" - required: true - default: "Something like 1.0.0" -outputs: - issue-id: - description: "ID of the created issue on GitHub" -runs: - using: "node12" - main: "dist/index.js" diff --git a/.github/workflows/buildpack-ubuntu2004.yml b/.github/workflows/buildpack-ubuntu2004.yml index b8ea41aaa798..d3af9474faf4 100644 --- a/.github/workflows/buildpack-ubuntu2004.yml +++ b/.github/workflows/buildpack-ubuntu2004.yml @@ -65,10 +65,10 @@ jobs: - name: Building Action run: npm i && npm run build - working-directory: ./.github/actions/create-issue + working-directory: ./.github/actions/buildpack-pr-comment - name: Create Review Issue - uses: ./.github/actions/create-issue + uses: ./.github/actions/buildpack-pr-comment with: token: ${{ secrets.GITHUB_TOKEN }} action-id: ${{ github.run_id }} From 11c494c9a6a0b9495f55cffae02c7ff3afb6da9f Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 17:58:20 -0500 Subject: [PATCH 09/16] Add package name & version. --- .github/actions/buildpack-pr-comment/action.yml | 8 ++++++++ .github/actions/buildpack-pr-comment/src/index.ts | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/actions/buildpack-pr-comment/action.yml b/.github/actions/buildpack-pr-comment/action.yml index adb906b15a6a..695bdcf41be0 100644 --- a/.github/actions/buildpack-pr-comment/action.yml +++ b/.github/actions/buildpack-pr-comment/action.yml @@ -9,6 +9,14 @@ inputs: description: "GitHub Action ID" required: true default: "" + package-name: + description: "Name of the package being released" + required: true + default: "Something like buildpack-ubuntu2004" + package-version: + description: "Version of the package being released" + required: true + default: "Something like 1.0.0" artifact: description: "Name of the artifact" required: true diff --git a/.github/actions/buildpack-pr-comment/src/index.ts b/.github/actions/buildpack-pr-comment/src/index.ts index 0b2b0a8a0cfc..79cce11539e6 100644 --- a/.github/actions/buildpack-pr-comment/src/index.ts +++ b/.github/actions/buildpack-pr-comment/src/index.ts @@ -10,9 +10,11 @@ async function run() { await octokit.issues.createComment({ ...context.repo, issue_number: context.payload.pull_request!.number, - body: `Action: ${core.getInput("action-id")}\n`+ - `Artifact: ${core.getInput("artifact")}\n`+ - `Commit: ${context.sha}` + body: `Package: ${core.getInput("package-name")}\n` + + `Version: ${core.getInput("package-version")}\n` + + `Action: ${core.getInput("action-id")}\n` + + `Artifact: ${core.getInput("artifact")}\n` + + `Commit: ${context.sha}` }); } From c7b491025144c3f6cf3f34503fa2cb4f898c4806 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 18:06:19 -0500 Subject: [PATCH 10/16] Enable all steps. --- .github/workflows/buildpack-ubuntu2004.yml | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/buildpack-ubuntu2004.yml b/.github/workflows/buildpack-ubuntu2004.yml index d3af9474faf4..d973d068e0ef 100644 --- a/.github/workflows/buildpack-ubuntu2004.yml +++ b/.github/workflows/buildpack-ubuntu2004.yml @@ -18,32 +18,32 @@ jobs: steps: - uses: actions/checkout@v2 -# - name: Check version -# run: | -# VERSION=$(grep "LABEL version" scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT | awk -F'"' '$0=$2') -# echo "::set-env name=VERSION::$VERSION" -# -# echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin -# VERSION_EXIST=$(docker pull -q $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:${VERSION} || echo false && true) -# docker logout docker.pkg.github.com -# -# if [ "${VERSION_EXIST}" != "false" ] -# then -# echo "" -# echo "ERROR: version '${VERSION}' already exist for '$IMAGE_NAME-$IMAGE_VARIANT'. Aborting." -# echo "" -# -# false -# fi + - name: Check version + run: | + VERSION=$(grep "LABEL version" scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT | awk -F'"' '$0=$2') + echo "::set-env name=VERSION::$VERSION" + + echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin + VERSION_EXIST=$(docker pull -q $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT:${VERSION} || echo false && true) + docker logout docker.pkg.github.com + + if [ "${VERSION_EXIST}" != "false" ] + then + echo "" + echo "ERROR: version '${VERSION}' already exist for '$IMAGE_NAME-$IMAGE_VARIANT'. Aborting." + echo "" + + false + fi - name: Build image run: | docker build scripts/docker/${IMAGE_NAME} --file scripts/docker/${IMAGE_NAME}/Dockerfile.$IMAGE_VARIANT --tag $IMAGE_NAME -# - name: Test image -# run: | -# docker run -v ${PWD}:/tmp -e CI=1 $IMAGE_NAME /tmp/scripts/build.sh -# + - name: Test image + run: | + docker run -v ${PWD}:/tmp -e CI=1 $IMAGE_NAME /tmp/scripts/build.sh + - name: Save image run: | docker save -o $IMAGE_NAME-$IMAGE_VARIANT.tar $IMAGE_NAME From 456dec2fae584495ccd1ef40295a5acc6c54b6d4 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 18:08:36 -0500 Subject: [PATCH 11/16] Set version to 0.0.2. --- .github/workflows/buildpack-ubuntu2004.yml | 6 +++--- scripts/docker/buildpack/Dockerfile.ubuntu2004 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/buildpack-ubuntu2004.yml b/.github/workflows/buildpack-ubuntu2004.yml index d973d068e0ef..4905fc923b56 100644 --- a/.github/workflows/buildpack-ubuntu2004.yml +++ b/.github/workflows/buildpack-ubuntu2004.yml @@ -58,16 +58,16 @@ jobs: name: ${{ env.ARCHIVE }} path: ${{ env.ARCHIVE }} - - name: Prepare create release issue action + - name: Prepare action uses: actions/setup-node@v1 with: node-version: "12.x" - - name: Building Action + - name: Build action run: npm i && npm run build working-directory: ./.github/actions/buildpack-pr-comment - - name: Create Review Issue + - name: Create buildpack comment on PR uses: ./.github/actions/buildpack-pr-comment with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/docker/buildpack/Dockerfile.ubuntu2004 b/scripts/docker/buildpack/Dockerfile.ubuntu2004 index fab184f913ae..1212fa6c34ab 100644 --- a/scripts/docker/buildpack/Dockerfile.ubuntu2004 +++ b/scripts/docker/buildpack/Dockerfile.ubuntu2004 @@ -22,7 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:focal AS base -LABEL version="0.0.1" +LABEL version="0.0.2" ARG DEBIAN_FRONTEND=noninteractive From bed4ff0ade016f25e23f81fe769a8e63f6ff1f54 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 19:33:26 -0500 Subject: [PATCH 12/16] Add pr labeling workflow. --- .github/actions/buildpack-pr-check/action.yml | 11 + .../buildpack-pr-check/package-lock.json | 394 ++++++++++++++++++ .../actions/buildpack-pr-check/package.json | 20 + .../actions/buildpack-pr-check/src/index.ts | 47 +++ .../actions/buildpack-pr-check/tsconfig.json | 10 + .github/workflows/buildpack-create.yml | 46 ++ 6 files changed, 528 insertions(+) create mode 100644 .github/actions/buildpack-pr-check/action.yml create mode 100644 .github/actions/buildpack-pr-check/package-lock.json create mode 100644 .github/actions/buildpack-pr-check/package.json create mode 100644 .github/actions/buildpack-pr-check/src/index.ts create mode 100644 .github/actions/buildpack-pr-check/tsconfig.json create mode 100644 .github/workflows/buildpack-create.yml diff --git a/.github/actions/buildpack-pr-check/action.yml b/.github/actions/buildpack-pr-check/action.yml new file mode 100644 index 000000000000..512449e80e37 --- /dev/null +++ b/.github/actions/buildpack-pr-check/action.yml @@ -0,0 +1,11 @@ +name: "Checks whether a PR is buildpack related" +description: "Checks whether a PR is buildpack related" +inputs: + token: + description: "GitHub access token" + required: true + default: "" +runs: + using: "node12" + main: "dist/index.js" + diff --git a/.github/actions/buildpack-pr-check/package-lock.json b/.github/actions/buildpack-pr-check/package-lock.json new file mode 100644 index 000000000000..c086e4c752e3 --- /dev/null +++ b/.github/actions/buildpack-pr-check/package-lock.json @@ -0,0 +1,394 @@ +{ + "name": "buildpack-pr-comment", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@actions/core": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz", + "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==" + }, + "@actions/github": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-2.1.1.tgz", + "integrity": "sha512-kAgTGUx7yf5KQCndVeHSwCNZuDBvPyxm5xKTswW2lofugeuC1AZX73nUUVDNaysnM9aKFMHv9YCdVJbg7syEyA==", + "requires": { + "@actions/http-client": "^1.0.3", + "@octokit/graphql": "^4.3.1", + "@octokit/rest": "^16.43.1" + } + }, + "@actions/http-client": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz", + "integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==", + "requires": { + "tunnel": "0.0.6" + } + }, + "@octokit/auth-token": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.0.tgz", + "integrity": "sha512-eoOVMjILna7FVQf96iWc3+ZtE/ZT6y8ob8ZzcqKY1ibSQCnu4O/B7pJvzMx5cyZ/RjAff6DAdEb0O0Cjcxidkg==", + "requires": { + "@octokit/types": "^2.0.0" + } + }, + "@octokit/endpoint": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.5.3.tgz", + "integrity": "sha512-EzKwkwcxeegYYah5ukEeAI/gYRLv2Y9U5PpIsseGSFDk+G3RbipQGBs8GuYS1TLCtQaqoO66+aQGtITPalxsNQ==", + "requires": { + "@octokit/types": "^2.0.0", + "is-plain-object": "^3.0.0", + "universal-user-agent": "^5.0.0" + }, + "dependencies": { + "universal-user-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-5.0.0.tgz", + "integrity": "sha512-B5TPtzZleXyPrUMKCpEHFmVhMN6EhmJYjG5PQna9s7mXeSqGTLap4OpqLl5FCEFUI3UBmllkETwKf/db66Y54Q==", + "requires": { + "os-name": "^3.1.0" + } + } + } + }, + "@octokit/graphql": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.3.1.tgz", + "integrity": "sha512-hCdTjfvrK+ilU2keAdqNBWOk+gm1kai1ZcdjRfB30oA3/T6n53UVJb7w0L5cR3/rhU91xT3HSqCd+qbvH06yxA==", + "requires": { + "@octokit/request": "^5.3.0", + "@octokit/types": "^2.0.0", + "universal-user-agent": "^4.0.0" + } + }, + "@octokit/plugin-paginate-rest": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz", + "integrity": "sha512-jbsSoi5Q1pj63sC16XIUboklNw+8tL9VOnJsWycWYR78TKss5PVpIPb1TUUcMQ+bBh7cY579cVAWmf5qG+dw+Q==", + "requires": { + "@octokit/types": "^2.0.1" + } + }, + "@octokit/plugin-request-log": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.0.tgz", + "integrity": "sha512-ywoxP68aOT3zHCLgWZgwUJatiENeHE7xJzYjfz8WI0goynp96wETBF+d95b8g/uL4QmS6owPVlaxiz3wyMAzcw==" + }, + "@octokit/plugin-rest-endpoint-methods": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-2.4.0.tgz", + "integrity": "sha512-EZi/AWhtkdfAYi01obpX0DF7U6b1VRr30QNQ5xSFPITMdLSfhcBqjamE3F+sKcxPbD7eZuMHu3Qkk2V+JGxBDQ==", + "requires": { + "@octokit/types": "^2.0.1", + "deprecation": "^2.3.1" + } + }, + "@octokit/request": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.3.2.tgz", + "integrity": "sha512-7NPJpg19wVQy1cs2xqXjjRq/RmtSomja/VSWnptfYwuBxLdbYh2UjhGi0Wx7B1v5Iw5GKhfFDQL7jM7SSp7K2g==", + "requires": { + "@octokit/endpoint": "^5.5.0", + "@octokit/request-error": "^1.0.1", + "@octokit/types": "^2.0.0", + "deprecation": "^2.0.0", + "is-plain-object": "^3.0.0", + "node-fetch": "^2.3.0", + "once": "^1.4.0", + "universal-user-agent": "^5.0.0" + }, + "dependencies": { + "universal-user-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-5.0.0.tgz", + "integrity": "sha512-B5TPtzZleXyPrUMKCpEHFmVhMN6EhmJYjG5PQna9s7mXeSqGTLap4OpqLl5FCEFUI3UBmllkETwKf/db66Y54Q==", + "requires": { + "os-name": "^3.1.0" + } + } + } + }, + "@octokit/request-error": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.1.tgz", + "integrity": "sha512-+6yDyk1EES6WK+l3viRDElw96MvwfJxCt45GvmjDUKWjYIb3PJZQkq3i46TwGwoPD4h8NmTrENmtyA1FwbmhRA==", + "requires": { + "@octokit/types": "^2.0.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "@octokit/rest": { + "version": "16.43.1", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.43.1.tgz", + "integrity": "sha512-gfFKwRT/wFxq5qlNjnW2dh+qh74XgTQ2B179UX5K1HYCluioWj8Ndbgqw2PVqa1NnVJkGHp2ovMpVn/DImlmkw==", + "requires": { + "@octokit/auth-token": "^2.4.0", + "@octokit/plugin-paginate-rest": "^1.1.1", + "@octokit/plugin-request-log": "^1.0.0", + "@octokit/plugin-rest-endpoint-methods": "2.4.0", + "@octokit/request": "^5.2.0", + "@octokit/request-error": "^1.0.2", + "atob-lite": "^2.0.0", + "before-after-hook": "^2.0.0", + "btoa-lite": "^1.0.0", + "deprecation": "^2.0.0", + "lodash.get": "^4.4.2", + "lodash.set": "^4.3.2", + "lodash.uniq": "^4.5.0", + "octokit-pagination-methods": "^1.1.0", + "once": "^1.4.0", + "universal-user-agent": "^4.0.0" + } + }, + "@octokit/types": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.5.0.tgz", + "integrity": "sha512-KEnLwOfdXzxPNL34fj508bhi9Z9cStyN7qY1kOfVahmqtAfrWw6Oq3P4R+dtsg0lYtZdWBpUrS/Ixmd5YILSww==", + "requires": { + "@types/node": ">= 8" + } + }, + "@types/node": { + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.0.tgz", + "integrity": "sha512-0ARSQootUG1RljH2HncpsY2TJBfGQIKOOi7kxzUY6z54ePu/ZD+wJA8zI2Q6v8rol2qpG/rvqsReco8zNMPvhQ==" + }, + "atob-lite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", + "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=" + }, + "before-after-hook": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", + "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==" + }, + "btoa-lite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", + "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=" + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "is-plain-object": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz", + "integrity": "sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==", + "requires": { + "isobject": "^4.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz", + "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==" + }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" + }, + "lodash.set": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", + "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" + }, + "macos-release": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz", + "integrity": "sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA==" + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "^2.0.0" + } + }, + "octokit-pagination-methods": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", + "integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "os-name": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", + "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", + "requires": { + "macos-release": "^2.2.0", + "windows-release": "^3.1.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + }, + "tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" + }, + "typescript": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "dev": true + }, + "universal-user-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.1.tgz", + "integrity": "sha512-LnST3ebHwVL2aNe4mejI9IQh2HfZ1RLo8Io2HugSif8ekzD1TlWpHpColOB/eh8JHMLkGH3Akqf040I+4ylNxg==", + "requires": { + "os-name": "^3.1.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "windows-release": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.2.0.tgz", + "integrity": "sha512-QTlz2hKLrdqukrsapKsINzqMgOUpQW268eJ0OaOpJN32h272waxR9fkB9VoWRtK7uKHG5EHJcTXQBD8XZVJkFA==", + "requires": { + "execa": "^1.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/.github/actions/buildpack-pr-check/package.json b/.github/actions/buildpack-pr-check/package.json new file mode 100644 index 000000000000..6749a4814ab2 --- /dev/null +++ b/.github/actions/buildpack-pr-check/package.json @@ -0,0 +1,20 @@ +{ + "name": "buildpack-pr-comment", + "version": "1.0.0", + "description": "An action that checks whether a pr was buildpack related", + "private": true, + "main": "index.js", + "scripts": { + "build": "tsc" + }, + "keywords": [], + "author": "Alexander Arlt", + "license": "MIT", + "dependencies": { + "@actions/core": "^1.2.4", + "@actions/github": "^2.1.1" + }, + "devDependencies": { + "typescript": "^3.8.3" + } +} diff --git a/.github/actions/buildpack-pr-check/src/index.ts b/.github/actions/buildpack-pr-check/src/index.ts new file mode 100644 index 000000000000..45cfb3b69432 --- /dev/null +++ b/.github/actions/buildpack-pr-check/src/index.ts @@ -0,0 +1,47 @@ +import * as core from "@actions/core"; +import * as github from "@actions/github"; + +async function run() { + const token = core.getInput("token"); + + const octokit = new github.GitHub(token); + const context = github.context; + + const comments = await octokit.issues.listComments({ + ...context.repo, + issue_number: context.payload.pull_request!.number + }); + + const actionComment = comments.data.find( + comment => comment.body.indexOf("Package: ") >= 0 && + comment.body.indexOf("Version: ") >= 0 && + comment.body.indexOf("Action: ") >= 0 && + comment.body.indexOf("Artifact: ") >= 0 && + comment.body.indexOf("Commit: ") >= 0 + ); + + pack = actionComment.body.substr(comment.body.indexOf("Package: ") + 10) + pack = pack.subst(pack.indexOf("\n")); + version = actionComment.body.substr(comment.body.indexOf("Version: ") + 10) + version = version.subst(version.indexOf("\n")); + action = actionComment.body.substr(comment.body.indexOf("Action: ") + 10) + action = action.subst(action.indexOf("\n")); + artifact = actionComment.body.substr(comment.body.indexOf("Artifact: ") + 10) + artifact = artifact.subst(artifact.indexOf("\n")); + commit = actionComment.body.substr(comment.body.indexOf("Commit: ") + 10) + commit = commit.subst(commit.indexOf("\n")); + + core.setOutput("package", pack.trim()); + core.setOutput("version", version.trim()); + core.setOutput("action", action.trim()); + core.setOutput("artifact", artifact.trim()); + core.setOutput("commit", commit.trim()); + + console.log("package", pack.trim()); + console.log("version", version.trim()); + console.log("action", action.trim()); + console.log("artifact", artifact.trim()); + console.log("commit", commit.trim()); +} + +run(); diff --git a/.github/actions/buildpack-pr-check/tsconfig.json b/.github/actions/buildpack-pr-check/tsconfig.json new file mode 100644 index 000000000000..67d94bc92287 --- /dev/null +++ b/.github/actions/buildpack-pr-check/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "outDir": "dist" + } +} diff --git a/.github/workflows/buildpack-create.yml b/.github/workflows/buildpack-create.yml new file mode 100644 index 000000000000..c15978179208 --- /dev/null +++ b/.github/workflows/buildpack-create.yml @@ -0,0 +1,46 @@ +name: buildpack:emscripten + +on: + issues: + types: [labeled] + +jobs: + build: + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_DOCKER_REPOSITORY: docker.pkg.github.com/${{ github.repository }} + IMAGE_NAME: buildpack + IMAGE_VARIANT: emscripten + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Prepare action + uses: actions/setup-node@v1 + with: + node-version: "12.x" + + - name: Build action + run: npm i && npm run build + working-directory: ./.github/actions/buildpack-pr-check + + - name: Create buildpack comment on PR + uses: ./.github/actions/buildpack-pr-check + with: + token: ${{ secrets.GITHUB_TOKEN }} + +# - name: Push image +# run: | +# echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin +# +# EMSDK_VERSION=$(grep "emscripten/emsdk" scripts/docker/buildpack/Dockerfile.emscripten | cut -f 2 -d ' ' | cut -f 2 -d ':') +# VERSION=$(docker inspect --format={{.Config.Labels.version}} $IMAGE_NAME) +# docker tag $IMAGE_NAME $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT-$EMSDK_VERSION:$VERSION +# docker push $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT-$EMSDK_VERSION:$VERSION +# +# docker tag $IMAGE_NAME $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT-$EMSDK_VERSION:latest +# docker push $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME-$IMAGE_VARIANT-$EMSDK_VERSION:latest +# +# docker logout From 50c6042d7b1bfbc69536412c3b5fcc48e4769124 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 19:45:49 -0500 Subject: [PATCH 13/16] buildpack-create workflow fix. --- .github/actions/buildpack-pr-check/src/index.ts | 9 ++++----- .github/workflows/buildpack-create.yml | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/actions/buildpack-pr-check/src/index.ts b/.github/actions/buildpack-pr-check/src/index.ts index 45cfb3b69432..b28667efd80d 100644 --- a/.github/actions/buildpack-pr-check/src/index.ts +++ b/.github/actions/buildpack-pr-check/src/index.ts @@ -20,16 +20,15 @@ async function run() { comment.body.indexOf("Commit: ") >= 0 ); - pack = actionComment.body.substr(comment.body.indexOf("Package: ") + 10) + pack = actionComment.body.substr(comment.body.indexOf("Package: ") + 9) pack = pack.subst(pack.indexOf("\n")); - version = actionComment.body.substr(comment.body.indexOf("Version: ") + 10) + version = actionComment.body.substr(comment.body.indexOf("Version: ") + 9) version = version.subst(version.indexOf("\n")); - action = actionComment.body.substr(comment.body.indexOf("Action: ") + 10) + action = actionComment.body.substr(comment.body.indexOf("Action: ") + 8) action = action.subst(action.indexOf("\n")); artifact = actionComment.body.substr(comment.body.indexOf("Artifact: ") + 10) artifact = artifact.subst(artifact.indexOf("\n")); - commit = actionComment.body.substr(comment.body.indexOf("Commit: ") + 10) - commit = commit.subst(commit.indexOf("\n")); + commit = actionComment.body.substr(comment.body.indexOf("Commit: ") + 8) core.setOutput("package", pack.trim()); core.setOutput("version", version.trim()); diff --git a/.github/workflows/buildpack-create.yml b/.github/workflows/buildpack-create.yml index c15978179208..43a50fca81e7 100644 --- a/.github/workflows/buildpack-create.yml +++ b/.github/workflows/buildpack-create.yml @@ -18,9 +18,9 @@ jobs: - uses: actions/checkout@v2 - name: Prepare action - uses: actions/setup-node@v1 - with: - node-version: "12.x" + uses: actions/setup-node@v1 + with: + node-version: "12.x" - name: Build action run: npm i && npm run build From e00acb8a0eda704a20a52c7fd0b8098f0be4b9c0 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 19:55:12 -0500 Subject: [PATCH 14/16] buildpack-pr-check corrections. --- .../buildpack-pr-check/package-lock.json | 2 +- .../actions/buildpack-pr-check/package.json | 2 +- .../actions/buildpack-pr-check/src/index.ts | 44 ++++++++++--------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/actions/buildpack-pr-check/package-lock.json b/.github/actions/buildpack-pr-check/package-lock.json index c086e4c752e3..9f4978208850 100644 --- a/.github/actions/buildpack-pr-check/package-lock.json +++ b/.github/actions/buildpack-pr-check/package-lock.json @@ -1,5 +1,5 @@ { - "name": "buildpack-pr-comment", + "name": "buildpack-pr-check", "version": "1.0.0", "lockfileVersion": 1, "requires": true, diff --git a/.github/actions/buildpack-pr-check/package.json b/.github/actions/buildpack-pr-check/package.json index 6749a4814ab2..80448c50630f 100644 --- a/.github/actions/buildpack-pr-check/package.json +++ b/.github/actions/buildpack-pr-check/package.json @@ -1,5 +1,5 @@ { - "name": "buildpack-pr-comment", + "name": "buildpack-pr-check", "version": "1.0.0", "description": "An action that checks whether a pr was buildpack related", "private": true, diff --git a/.github/actions/buildpack-pr-check/src/index.ts b/.github/actions/buildpack-pr-check/src/index.ts index b28667efd80d..21379cf419be 100644 --- a/.github/actions/buildpack-pr-check/src/index.ts +++ b/.github/actions/buildpack-pr-check/src/index.ts @@ -20,27 +20,29 @@ async function run() { comment.body.indexOf("Commit: ") >= 0 ); - pack = actionComment.body.substr(comment.body.indexOf("Package: ") + 9) - pack = pack.subst(pack.indexOf("\n")); - version = actionComment.body.substr(comment.body.indexOf("Version: ") + 9) - version = version.subst(version.indexOf("\n")); - action = actionComment.body.substr(comment.body.indexOf("Action: ") + 8) - action = action.subst(action.indexOf("\n")); - artifact = actionComment.body.substr(comment.body.indexOf("Artifact: ") + 10) - artifact = artifact.subst(artifact.indexOf("\n")); - commit = actionComment.body.substr(comment.body.indexOf("Commit: ") + 8) - - core.setOutput("package", pack.trim()); - core.setOutput("version", version.trim()); - core.setOutput("action", action.trim()); - core.setOutput("artifact", artifact.trim()); - core.setOutput("commit", commit.trim()); - - console.log("package", pack.trim()); - console.log("version", version.trim()); - console.log("action", action.trim()); - console.log("artifact", artifact.trim()); - console.log("commit", commit.trim()); + if (actionComment) { + let pack = actionComment!.body.substr(actionComment!.body.indexOf("Package: ") + 9) + pack = pack.substr(0, pack.indexOf("\n")); + let version = actionComment!.body.substr(actionComment!.body.indexOf("Version: ") + 9) + version = version.substr(0, version.indexOf("\n")); + let action = actionComment!.body.substr(actionComment!.body.indexOf("Action: ") + 8) + action = action.substr(0, action.indexOf("\n")); + let artifact = actionComment!.body.substr(actionComment!.body.indexOf("Artifact: ") + 10) + artifact = artifact.substr(0, artifact.indexOf("\n")); + let commit = actionComment!.body.substr(actionComment!.body.indexOf("Commit: ") + 8) + + core.setOutput("package", pack.trim()); + core.setOutput("version", version.trim()); + core.setOutput("action", action.trim()); + core.setOutput("artifact", artifact.trim()); + core.setOutput("commit", commit.trim()); + + console.log("package", pack.trim()); + console.log("version", version.trim()); + console.log("action", action.trim()); + console.log("artifact", artifact.trim()); + console.log("commit", commit.trim()); + } } run(); From 1e20ee8114b0133cf3706666b9d31d33482c3448 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 19:57:25 -0500 Subject: [PATCH 15/16] buildpack-create --- .github/workflows/buildpack-create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildpack-create.yml b/.github/workflows/buildpack-create.yml index 43a50fca81e7..1ed0c0f1b502 100644 --- a/.github/workflows/buildpack-create.yml +++ b/.github/workflows/buildpack-create.yml @@ -1,4 +1,4 @@ -name: buildpack:emscripten +name: buildpack:create on: issues: From 6d887f88825e6ce9028a2ad1b5d832960b5cd7f4 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 7 Jul 2020 20:17:58 -0500 Subject: [PATCH 16/16] on pull_request --- .github/workflows/buildpack-create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildpack-create.yml b/.github/workflows/buildpack-create.yml index 1ed0c0f1b502..e32710bcf15b 100644 --- a/.github/workflows/buildpack-create.yml +++ b/.github/workflows/buildpack-create.yml @@ -1,7 +1,7 @@ name: buildpack:create on: - issues: + pull_request: types: [labeled] jobs: