Skip to content

Commit

Permalink
Some fixes for CI scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
d1vanov committed Nov 30, 2023
1 parent 0ddd8df commit 04e6d45
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1385,10 +1385,26 @@ jobs:
export BRANCH_NAME=$(echo $GITHUB_REF | sed 's/.*\/\(.*\)$/\1/')
gh api /repos/d1vanov/libquentier/releases/tags/continuous-${BRANCH_NAME} > /tmp/gh_get_release.json && exit_status=$? || exit_status=$?
if [ "${exit_status}" = 0 ]; then
export COMMIT_SHA=$(cat /tmp/gh_get_release.json | jq '.target_commitish');
export COMMIT_SHA=$(cat /tmp/gh_get_release.json | jq '.target_commitish')
if ! [ "${COMMIT_SHA}" = "${GITHUB_SHA}" ]; then
gh release delete continuous-${BRANCH_NAME} -y -R d1vanov/libquentier;
curl -X DELETE -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/d1vanov/libquentier/git/refs/tags/continuous-${BRANCH_NAME};
export PREVIOUS_CONTINUOUS_RELEASE_DELETED=0
for i in {1..10}
do
echo "Trying to delete previous continuous release continuous-${BRANCH_NAME}"
gh release delete continuous-${BRANCH_NAME} -y -R d1vanov/libquentier;
curl -X DELETE -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/d1vanov/libquentier/git/refs/tags/continuous-${BRANCH_NAME};
gh api /repos/d1vanov/libquentier/releases/tags/continuous-${BRANCH_NAME} > /tmp/gh_get_release.json && exit_status=$? || exit_status=$?
if [ "${exit_status}" != 0 ]; then
echo "It appears that previous continuous release is deleted now"
export PREVIOUS_CONTINUOUS_RELEASE_DELETED=1
break
fi
echo "Was able to receive information about the attempted to be deleted previous continuous release, waiting for 5 seconds before the next attempt"
sleep 5
done
if [ "$PREVIOUS_CONTINUOUS_RELEASE_DELETED" != "1" ]; then
echo "Failed to delete previous continuous release after several attempts!"
fi
fi
fi
shell: bash
Expand All @@ -1399,15 +1415,15 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create continuous-master --draft=false --prerelease --title "Continuous build (continuous-master)" -R d1vanov/libquentier
gh release create continuous-master --draft=false --prerelease --title "Continuous build (continuous-master)" --target $GITHUB_SHA -R d1vanov/libquentier
- name: Create new continuous development release
id: create_new_continuous_development_release
if: ${{ github.ref == 'refs/heads/development' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create continuous-development --draft=false --prerelease --title "Continuous build (continuous-development)" -R d1vanov/libquentier
gh release create continuous-development --draft=false --prerelease --title "Continuous build (continuous-development)" --target $GITHUB_SHA -R d1vanov/libquentier
- name: Create new tagged release
id: create_new_tagged_release
Expand All @@ -1416,7 +1432,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REF: ${{ github.ref }}
run: |
gh release create "$GITHUB_REF" --title "Release build ($GITHUB_REF)" -R d1vanov/libquentier
gh release create "$GITHUB_REF" --title "Release build ($GITHUB_REF)" --target $GITHUB_SHA -R d1vanov/libquentier
- name: Download linux artifact
id: download_linux_artifact
Expand Down Expand Up @@ -1725,6 +1741,6 @@ jobs:
if: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/development' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REF: ${{ github.ref }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
gh release edit "$GITHUB_REF" --draft=false -R d1vanov/libquentier
gh release edit "$GITHUB_REF_NAME" --draft=false -R d1vanov/libquentier

0 comments on commit 04e6d45

Please sign in to comment.