From 1da347bb10f471163fc84223178702182b3f3101 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi <nanasess@fsm.ne.jp> Date: Thu, 11 Nov 2021 19:20:53 +0900 Subject: [PATCH] =?UTF-8?q?Weekly=20build=20=E3=81=AE=E3=83=AA=E3=83=AA?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E3=83=8E=E3=83=BC=E3=83=88=E8=87=AA=E5=8B=95?= =?UTF-8?q?=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 前回のリリースからの変更を自動生成する --- .github/workflows/deploy.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 711f20f27f..f183b21028 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,6 +11,10 @@ jobs: name: Deploy runs-on: ubuntu-18.04 steps: + - name: PREVIOUS_TAG_NAME + run: | + echo "PREVIOUS_TAG_NAME=$(curl -H 'Accept: application/vnd.github.v3+json' https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)" >> $GITHUB_ENV + - name: TAG_NAME for schedule if: github.event_name == 'schedule' run: echo "TAG_NAME=eccube2-weekly-$(date +%Y%m%d)" >> $GITHUB_ENV @@ -42,6 +46,27 @@ jobs: draft: false prerelease: true + - name: RELEASE_BODY + if: github.event_name == 'schedule' + env: + TAG_NAME: ${{ env.TAG_NAME }} + run: | + echo 'RELEASE_BODY<<EOF' >> $GITHUB_ENV + echo $(curl -H 'Accept: application/vnd.github.v3+json' https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.TAG_NAME }} | jq -r .body | sed 's,",\\",g' | sed "s,',,g") >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + - name: RELEASE_ID + if: github.event_name == 'schedule' + env: + TAG_NAME: ${{ env.TAG_NAME }} + run: | + echo "RELEASE_ID=$(curl -H 'Accept: application/vnd.github.v3+json' https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.TAG_NAME }} | jq -r .id)" >> $GITHUB_ENV + - name: GENERATED_NOTES + if: github.event_name == 'schedule' + run: | + echo 'GENERATED_NOTES<<EOF' >> $GITHUB_ENV + echo $(curl -X POST -H 'Accept: application/vnd.github.v3+json' -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/releases/generate-notes -d '{"tag_name":"${{ env.TAG_NAME }}", "previous_tag_name":"${{ env.PREVIOUS_TAG_NAME }}"}' | jq .body | sed 's,",,g' | sed "s,',,g") >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + - name: Checkout code if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'prereleased' ) uses: actions/checkout@v2 @@ -208,3 +233,13 @@ jobs: asset_name: ${{ env.TAG_NAME }}.zip.checksum.sha256 tag: ${{ env.TAG_NAME }} overwrite: true + + - name: Update Release notes + if: github.event_name == 'schedule' + run: | + curl \ + -X PATCH \ + -H "Accept: application/vnd.github.v3+json" \ + -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }} \ + -d '{"draft":false, "body":"${{ env.RELEASE_BODY }}\n${{ env.GENERATED_NOTES }}"}'