From 5462a6aa354d5d9b31ee325beb539effd8eb25f3 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Thu, 21 Jan 2021 07:19:31 +0100 Subject: [PATCH] [RELEASE] Version 2.0.0 This release switches from helhum/ter-client to typo3/tailor. This allows us to use tokens instead of user/password --- .github/workflows/DockerHub.yml | 20 ++++++++++++++++++++ Docker/Dockerfile | 24 ++++++++++++++++++++++++ entrypoint.sh => Docker/entrypoint.sh | 17 ++++++++--------- Dockerfile | 17 +---------------- README.md | 11 +++++++---- action.yml | 11 +++-------- 6 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/DockerHub.yml create mode 100644 Docker/Dockerfile rename entrypoint.sh => Docker/entrypoint.sh (54%) diff --git a/.github/workflows/DockerHub.yml b/.github/workflows/DockerHub.yml new file mode 100644 index 0000000..5fc126f --- /dev/null +++ b/.github/workflows/DockerHub.yml @@ -0,0 +1,20 @@ +name: "Update Docker Images" + +on: [ push, pull_request ] + +jobs: + MoveTag: + name: "Docker Image" + runs-on: "ubuntu-latest" + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Docker Login + run: docker login --username=${{ secrets.DOCKER_HUB_USERNAME }} --password=${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Docker Build + run: docker build -t tomasnorre/typo3teruploader:latest Docker/ + + - name: Docker Push + run: docker push tomasnorre/typo3teruploader:latest \ No newline at end of file diff --git a/Docker/Dockerfile b/Docker/Dockerfile new file mode 100644 index 0000000..cb40054 --- /dev/null +++ b/Docker/Dockerfile @@ -0,0 +1,24 @@ +FROM composer:2 +FROM bash:5 +FROM php:7.4-alpine + +# copy from the images into the PHP Image +COPY --from=composer /usr/bin/composer /usr/bin/composer +COPY --from=bash /usr/local/bin/bash /usr/bin/bash + +COPY entrypoint.sh /entrypoint.sh + +RUN apk update && apk upgrade && \ + apk add bash git jq libxml2-dev libzip-dev icu-dev curl && \ + rm -rf /var/cache/apk/* + +RUN docker-php-ext-install soap && \ + docker-php-ext-install zip && \ + docker-php-ext-configure intl && docker-php-ext-install intl + +RUN echo -e "Install typo3/tailor" && \ + composer global require typo3/tailor --prefer-dist --no-progress --no-suggest + +RUN ln -nfs /root/.composer/vendor/typo3/tailor/bin/tailor /usr/bin/tailor + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/Docker/entrypoint.sh similarity index 54% rename from entrypoint.sh rename to Docker/entrypoint.sh index 91a713b..172c01b 100755 --- a/entrypoint.sh +++ b/Docker/entrypoint.sh @@ -2,8 +2,9 @@ echo -e "Preparing upload of release ${GITHUB_REF#refs/tags/} to TER\n"; -echo -e "Install helhum/ter-client" -composer global require helhum/ter-client +# Prepare Tag information +TAG_WITHOUT_V=$(echo ${GITHUB_REF#refs/tags/} | sed 's/v//'); +TAG_MESSAGE=$(git log -1 --pretty=%B) echo -e "Preparing Release" COMPOSER_PREPARE_RELEASE=$(cat composer.json | jq '.scripts."prepare-release"') @@ -16,14 +17,12 @@ else fi # Fetch extension-key from composer.json -EXTKEY=$(cat composer.json | jq '.extra."typo3/cms"."extension-key"') +export TYPO3_EXTENSION_KEY=$(cat composer.json | jq '.extra."typo3/cms"."extension-key"' | tr -d '"') +export TYPO3_API_TOKEN=$1 -if [ -z "$EXTKEY" ] +if [ -z "$TYPO3_EXTENSION_KEY" ] then - echo "You have to set your extensionkey in composer.json, this will soon be mandatory in all TYPO3 Extensions., see README.md" + echo "You have to set your extension-key in composer.json, this will soon be mandatory in all TYPO3 Extensions., see README.md" fi -TAG_MESSAGE=$(git log -1 --pretty=%B) - -$HOME/.composer/vendor/helhum/ter-client/ter-client upload $EXTKEY . -u "$1" -p "$2" -m "$TAG_MESSAGE" - +tailor ter:publish --comment="$TAG_MESSAGE" $TAG_WITHOUT_V \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9775560..2c8dfa1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1 @@ -FROM composer:2 -FROM bash:5 -FROM php:7.4-alpine - -# copy from the images into the PHP Image -COPY --from=composer /usr/bin/composer /usr/bin/composer -COPY --from=bash /usr/local/bin/bash /usr/bin/bash - -COPY entrypoint.sh /entrypoint.sh - -RUN apk update && apk upgrade && \ - apk add bash git jq libxml2-dev && rm -rf /var/cache/apk/* - -RUN docker-php-ext-install soap - -ENTRYPOINT ["/entrypoint.sh"] +FROM tomasnorre/typo3teruploader:latest diff --git a/README.md b/README.md index ab2c14f..533f064 100644 --- a/README.md +++ b/README.md @@ -18,15 +18,14 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v1 - - uses: tomasnorre/typo3-upload-ter@v1 + - uses: tomasnorre/typo3-upload-ter@v2 with: - username: ${{ secrets.TYPO3_ORG_USERNAME }} - password: ${{ secrets.TYPO3_ORG_PASSWORD }} + api-token: ${{ secrets.TYPO3_API_TOKEN }} ``` ### Requirement -You have to set your extensionkey in `composer.json`, this will soon be mandatory in all TYPO3 Extensions. +You have to set your extension-key in `composer.json`, this will soon be mandatory in all TYPO3 Extensions. https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ExtensionArchitecture/ComposerJson/Index.html#extra @@ -39,6 +38,10 @@ https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ExtensionArchitect }, ``` +### Information + +The commit message will be you commit message of your `tag`, both `X.Y.Z` and `vX.Y.Z`-formatted tags are accepted. + ### Recommendation It's recommended to add a `prepare-release` to your composer.json `script`-section, if this exists it will run before zipping and uploading. diff --git a/action.yml b/action.yml index de63ef3..bfeeef3 100644 --- a/action.yml +++ b/action.yml @@ -4,17 +4,12 @@ branding: icon: upload color: orange inputs: - username: # id of input - description: 'Your TYPO3 Username - Use github.secrets' - required: true - default: '' - password: # id of input - description: 'Your TYPO3 Password - Use github.secrets' + api-token: # id of input + description: 'Your TYPO3 API Token - Use github.secrets' required: true default: '' runs: using: 'docker' image: 'Dockerfile' args: - - ${{ inputs.username }} - - ${{ inputs.password }} \ No newline at end of file + - ${{ inputs.api-token }} \ No newline at end of file