From f4167f1e2aa347a0c74729842ff5bccb3202a39a Mon Sep 17 00:00:00 2001 From: Aleh Hutnikau Date: Wed, 24 Mar 2021 14:52:29 +0300 Subject: [PATCH 1/3] ci: use https protocol --- views/package-lock.json | 4 ++++ views/package.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/views/package-lock.json b/views/package-lock.json index 4911bc5..69d0c6b 100644 --- a/views/package-lock.json +++ b/views/package-lock.json @@ -3,6 +3,10 @@ "requires": true, "lockfileVersion": 1, "dependencies": { + "eve": { + "version": "git+ssh://git@github.com/adobe-webplatform/eve.git#eef80ed8d188423c2272746fb8ae5cc8dad84cb1", + "from": "eve@git://github.com/adobe-webplatform/eve.git#eef80ed" + }, "npm-dummy-package": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/npm-dummy-package/-/npm-dummy-package-1.0.1.tgz", diff --git a/views/package.json b/views/package.json index 9440f82..b3af683 100644 --- a/views/package.json +++ b/views/package.json @@ -1,5 +1,4 @@ { - "name": "@oat-sa/tao-foobar", "description": "taoFooBar frontend modules", "repository": { @@ -7,6 +6,7 @@ "url": "git+https://github.com/oat-sa/extension-tao-foobar.git" }, "dependencies": { - "npm-dummy-package": "~1.0.1" + "npm-dummy-package": "~1.0.1", + "eve": "git://github.com/adobe-webplatform/eve.git#eef80ed" } } From 4a7f5fafc6a53b5c93cea5d3f9b5674c5cab4b84 Mon Sep 17 00:00:00 2001 From: Aleh Hutnikau Date: Wed, 24 Mar 2021 14:52:45 +0300 Subject: [PATCH 2/3] ci: use https protocol --- .github/workflows/release.yml | 74 +++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4025eef..3ad2b19 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,18 +3,76 @@ name: Relese Tao extension on: - push: + pull_request: branches: - develop + types: [closed] jobs: auto-release: + if: github.event.pull_request.merged == true name: Automated Tao extension release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Release - uses: oat-sa/extension-release-action@v0 - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - with: - github_token: ${{ secrets.GH_TOKEN }} + - name: Checkout code + uses: actions/checkout@v2 + + # Install PHP, composer v2 + - name: Setup PHP, + uses: shivammathur/setup-php@v2 + with: + php-version: '7.2' + tools: composer:v2 + env: + COMPOSER_TOKEN: ${{ secrets.GH_TOKEN }} + + # Prepare composer.json file + - name: Prepare composer file + run: | + php -r '$composerArray = json_decode(file_get_contents("./composer.json"), true); + $composerArray["require"][$composerArray["name"]] = "dev-develop"; + $composerArray["repositories"] = array_key_exists("repositories", $composerArray) ? $composerArray["repositories"] : []; + $composerArray["repositories"][] = [ + "type" => "vcs", + "url" => "https://github.com/".$composerArray["name"].".git" + ]; + unset($composerArray["name"]); + file_put_contents("./composer-release.json", json_encode($composerArray, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));' + + # Composer Install + - name: Install dependencies + run: | + COMPOSER=composer-release.json composer install --no-dev --no-interaction --prefer-source + + # Prepare to release + - name: Prepare to release + run: | + mkdir -p taoQtiItem/views/js/mathjax/ + touch taoQtiItem/views/js/mathjax/MathJax.js + mkdir -p tao/views/locales/en-US/ + echo '{"serial":"9","date":1615820392,"version":"3.3.0-9","translations":{}}' > tao/views/locales/en-US/messages.json + touch index.php + mkdir -p config/ + + # Install node + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + + # Do release + - name: Release Tao Extension + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + npm i -g @oat-sa/tao-extension-release + REPO_NAME=$(jq --raw-output '."name"' composer.json) + EXT_ID=$(jq --raw-output '.extra."tao-extension-name"' composer.json) + cd $EXT_ID + git config --global user.name github-actions + git config --global user.email github-actions@github.com + git config --global url."https://github.com/".insteadOf git@github.com: + git config --global url."https://".insteadOf git:// + git remote set-url --push origin https://${GITHUB_TOKEN}@github.com/$REPO_NAME.git + git checkout . + cd .. + taoRelease extensionRelease --extension-to-release ${EXT_ID} --no-interactive --no-write \ No newline at end of file From fdd4174dfadc2481847e7331ad8c84a262b8bf10 Mon Sep 17 00:00:00 2001 From: Aleh Hutnikau Date: Wed, 24 Mar 2021 15:12:24 +0300 Subject: [PATCH 3/3] ci: use https instead of ssh --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ad2b19..ef93de9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,6 +72,7 @@ jobs: git config --global user.email github-actions@github.com git config --global url."https://github.com/".insteadOf git@github.com: git config --global url."https://".insteadOf git:// + git config --global url."https://github.com/".insteadOf ssh://git@github.com/ git remote set-url --push origin https://${GITHUB_TOKEN}@github.com/$REPO_NAME.git git checkout . cd ..