From 2a2a7cfdd6e50829b3cfc32f9a64c3946257cb3f Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 5 Oct 2022 19:56:59 +0200 Subject: [PATCH] Deploy tagged commits --- .github/workflows/build.yml | 44 +++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8bec595568..4d95340d2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Fetch + uses: actions/checkout@v2 + - name: Unshallow + run: git fetch --prune --unshallow --tags --force - name: Set up Python uses: actions/setup-python@v2 with: @@ -20,4 +23,41 @@ jobs: python -m pip install -r requirements.txt - name: Build run: | - make + make -j -B dist + - name: Upload artifacts + if: github.ref_type == 'tag' + uses: actions/upload-artifact@v2 + with: + name: dist + path: Amiri-*.zip + if-no-files-found: error + + deploy: + if: github.ref_type == 'tag' + needs: build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + path: dist + + - name: Extract release notes from annotated tag message + run: | + # GH checkout action doesn't preserve tag annotations, we must fetch them + # https://github.com/actions/checkout/issues/290 + git fetch --tags --force + echo "$(git tag -l --format='%(contents:body)' ${{ github.ref_name }})" > "${{ runner.temp }}/release_body.md" + echo "release_name=$(git tag -l --format='%(contents:subject)' ${{ github.ref_name }})" >> $GITHUB_ENV + + - name: Publish + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.release_name }} + body_path: ${{ runner.temp }}/release_body.md + fail_on_unmatched_files: true + files: | + dist/*/*