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 Jul 17, 2024
1 parent 85f48e7 commit 5340fbc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/build_app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit 5340fbc

Please sign in to comment.