Skip to content

Commit

Permalink
build: replace hub command with gh
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Oct 9, 2023
1 parent a2c3358 commit 7b93e0c
Showing 1 changed file with 11 additions and 25 deletions.
36 changes: 11 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,20 @@ jobs:
if: ${{ github.ref_name == 'main' && !env.ACT }} # https://github.com/nektos/act#skipping-steps
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
api_base_url="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY"
# delete 'latest' github release
release_id=$(curl -fsL -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.[] | select(.name == "latest") | .id')
if [[ -n $release_id ]]; then
echo "Deleting release [$api_base_url/releases/$release_id]..."
curl -H "Authorization: token $GITHUB_TOKEN" -fsSL -X DELETE "$api_base_url/releases/$release_id"
fi
# delete 'latest' git tag
tag_url="$api_base_url/git/refs/tags/latest"
if curl -H "Authorization: token $GITHUB_TOKEN" -fsLo /dev/null --head "$tag_url"; then
echo "Deleting tag [$tag_url]..."
curl -H "Authorization: token $GITHUB_TOKEN" -fsSL -X DELETE "$tag_url"
fi
RELEASE_NAME: latest
# https://cli.github.com/manual/gh_release_delete
run: gh release delete "$RELEASE_NAME" --yes --cleanup-tag || true

- name: "Create 'latest' release"
if: ${{ github.ref_name == 'main' && !env.ACT }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: latest
# https://cli.github.com/manual/gh_release_create
run: |
set -eux
# https://hub.github.com/hub-release.1.html
hub release create "latest" \
--message "latest" \
--attach "work/artemis-overview-plugin-latest.zip" \
--attach "work/artemis-queues-plugin-latest.zip"
gh release create "$RELEASE_NAME" \
--latest \
--target "${{ github.sha }}" \
--notes "$RELEASE_NAME" \
work/artemis-overview-plugin-latest.zip \
work/artemis-queues-plugin-latest.zip

0 comments on commit 7b93e0c

Please sign in to comment.