Skip to content

Commit

Permalink
Update build_app.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterNjeim authored Jun 30, 2024
1 parent 8d2aaa4 commit 79c3d6c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build_app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Get latest release
run: |
echo "updated=true" >> $GITHUB_ENV
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
exit 1
fi
- name: Publish pre-release
if: env.updated == 'true'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
Expand Down Expand Up @@ -227,10 +235,15 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{
runs-on: ubuntu-latest
steps:
- name: Delete pre-release
if: env.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
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 }}/git/refs/tags/${{ github.ref_name }}
ID_B="$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_B }}/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_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'
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

0 comments on commit 79c3d6c

Please sign in to comment.