Skip to content

Commit

Permalink
chore: update action.yml
Browse files Browse the repository at this point in the history
ci: constraint docker publish to only linux/amd64
  • Loading branch information
Nicconike committed Oct 16, 2024
1 parent 78f2bcb commit 0eb215c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
docker:
name: Docker
runs-on: ubuntu-latest
# if: needs.semantic-release.outputs.new_release_version != ''
permissions:
contents: read
attestations: write
Expand Down Expand Up @@ -148,6 +149,7 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
secrets: |
Expand Down Expand Up @@ -231,13 +233,22 @@ jobs:
PACKAGE_NAME: "wakatime-leaderboards"
run: |
echo "Fetching GHCR tags..."
tags=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/user/packages/container/$PACKAGE_NAME/versions" | jq -r '.[].metadata.container.tags[]')
page=1
all_tags=""
while true; do
tags=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/user/packages/container/$PACKAGE_NAME/versions?per_page=100&page=$page" | jq -r '.[].metadata.container.tags[]')
if [ -z "$tags" ]; then
break
fi
all_tags="$all_tags $tags"
((page++))
done
echo "Tags found in GHCR:"
echo "$tags"
latest_tag=$(echo "$tags" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -rV | head -n 1)
echo "$all_tags"
latest_tag=$(echo "$all_tags" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -rV | head -n 1)
echo "Latest semantic version tag is $latest_tag"
for tag in $tags; do
for tag in $all_tags; do
if [[ "$tag" != "master" && "$tag" != "$latest_tag" ]]; then
echo "Deleting tag $tag from GHCR"
version_id=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ inputs:
required: true
runs:
using: docker
image: "docker://nicconike/wakatime-leaderboards:latest"
image: "docker://nicconike/wakatime-leaderboards:master"
branding:
icon: activity
color: blue

0 comments on commit 0eb215c

Please sign in to comment.