From dfe8c12fb81137518aa80d99925fce1ce579e7c8 Mon Sep 17 00:00:00 2001 From: lens0021 Date: Mon, 20 Jul 2020 14:56:39 +0900 Subject: [PATCH] build: Change releasing steps Related to femiwiki/femiwiki#200 (copied from https://github.com/femiwiki/.github/blob/242bbdb0/workflow-templates/extension-release.yml) --- .github/workflows/release-and-submit.yml | 62 ++++++++++++++++++++++++ .github/workflows/submit-patch.yml | 29 ----------- 2 files changed, 62 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/release-and-submit.yml delete mode 100644 .github/workflows/submit-patch.yml diff --git a/.github/workflows/release-and-submit.yml b/.github/workflows/release-and-submit.yml new file mode 100644 index 0000000..ba40448 --- /dev/null +++ b/.github/workflows/release-and-submit.yml @@ -0,0 +1,62 @@ +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Upload Release Asset and submit a PR to docker-mediawiki repository + +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@2.3.1 + with: + php-version: '7.3' + tools: composer:v1 + - name: Set tag name + id: tag_name + run: echo "::set-output name=tag_name::$(basename ${{ github.ref }})" + - name: Build project + run: | + composer update --no-dev + yarn --prod + tar --exclude-vcs -C .. -zcvf "../${{ steps.tag_name.outputs.tag_name }}.tar.gz" "$(basename "$(pwd)")" + mv ../${{ steps.tag_name.outputs.tag_name }}.tar.gz ./ + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ steps.tag_name.outputs.tag_name }}.tar.gz + asset_name: ${{ steps.tag_name.outputs.tag_name }}.tar.gz + asset_content_type: application/zip + - name: Submit a PR + run: | + curl \ + --fail \ + --request POST \ + --url https://api.github.com/repos/femiwiki/docker-mediawiki/dispatches \ + --header "Authorization: token ${{ secrets.BOT_TOKEN }}" \ + --header 'content-type: application/json' \ + --data '{ + "event_type": "bump-extension", + "client_payload": { + "extension": "${{ github.event.repository.name }}", + "version": "${{ steps.tag_name.outputs.tag_name }}" + } + }' diff --git a/.github/workflows/submit-patch.yml b/.github/workflows/submit-patch.yml deleted file mode 100644 index 6514b29..0000000 --- a/.github/workflows/submit-patch.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Submit a PR to docker-mediawiki repository - -on: - push: - branches: - - REL1_34 - paths-ignore: - - 'i18n/**' - - '.github/**' - -jobs: - build: - runs-on: ubuntu-18.04 - - steps: - - run: | - curl \ - --fail \ - --request POST \ - --url https://api.github.com/repos/femiwiki/docker-mediawiki/dispatches \ - --header "Authorization: token ${{ secrets.BOT_TOKEN }}" \ - --header 'content-type: application/json' \ - --data '{ - "event_type": "bump-extension", - "client_payload": { - "extension": "${{ github.event.repository.name }}", - "version": "${{ github.sha }}" - } - }'