From 5340fbc5b33925858efd6a949d58fc782bdef6d9 Mon Sep 17 00:00:00 2001 From: Peter Njeim Date: Tue, 16 Jul 2024 21:05:17 -0300 Subject: [PATCH] Update build_app.yaml --- .github/workflows/build_app.yaml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_app.yaml b/.github/workflows/build_app.yaml index 015c1ea..b06f319 100644 --- a/.github/workflows/build_app.yaml +++ b/.github/workflows/build_app.yaml @@ -10,16 +10,19 @@ env: jobs: release: runs-on: ubuntu-latest + outputs: + output: ${{ steps.get_latest_release.outputs.updated }} steps: - name: Get latest release + id: get_latest_release run: | - echo "updated=true" >> $GITHUB_ENV + echo "updated=true" >> "$GITHUB_OUTPUT" if [[ "${{ github.ref_name }}" == "$(curl -s -u ${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }} -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/latest | jq --raw-output ".tag_name")" ]]; then - echo "updated=false" >> $GITHUB_ENV + echo "updated=false" >> "$GITHUB_OUTPUT" exit 1 fi - name: Publish pre-release - if: env.updated == 'true' + if: ${{ steps.get_latest_release.outputs.updated }} == 'true' uses: softprops/action-gh-release@v1 with: token: ${{ secrets.LIBRESCORE_TOKEN }} @@ -235,7 +238,7 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{ runs-on: ubuntu-latest steps: - name: Delete pre-release - if: env.updated == 'true' + if: ${{needs.release.outputs.updated}} == 'true' run: | ID_A="$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/tags/${{ github.ref_name }} | jq -r .id)" curl -s -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/$ID_A @@ -244,6 +247,6 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{ curl -s -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_B }}/releases/$ID_B curl -s -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_B }}/git/refs/tags/${{ github.ref_name }} - name: Delete workflow run - if: env.updated == 'false' + if: ${{needs.release.outputs.updated}} == 'false' run: | curl -s -i -u ${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }} -d '{"event_type":"delete_action","client_payload":{"run_id":"'"${{ github.run_id }}"'","repo":"LibreScore/app-librescore"}}' -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/LibreScore/actions/dispatches