Skip to content

Commit

Permalink
ci: cancels tests and release-ts concurrent workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed Apr 17, 2024
1 parent f945500 commit fd2b045
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release-ts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
Expand Down
18 changes: 15 additions & 3 deletions script/release-ts.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#!/bin/bash
#!/usr/bin/env bash

GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-$GITHUB_ACTION_REPOSITORY}

if [ -z "$GITHUB_REPOSITORY" ]; then
echo "Error: GITHUB_REPOSITORY or GITHUB_ACTION_REPOSITORY is not set."
exit 1
fi

if [ -z "$GITHUB_TOKEN" ]; then
echo "Error: GITHUB_TOKEN is not set."
exit 1
fi

API_URL="https://api.github.com"

Expand All @@ -8,7 +20,7 @@ log() {

log "Fetching the current latest release information..."
current_latest=$(curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" \
"$API_URL/repos/$GITHUB_ACTION_REPOSITORY/releases/latest")
"$API_URL/repos/$GITHUB_REPOSITORY/releases/latest")
current_latest_id=$(echo "$current_latest" | jq -r '.id')

if [ "$current_latest_id" == "null" ]; then
Expand All @@ -30,7 +42,7 @@ fi
log "Attempting to mark the release (ID: $current_latest_id) as the latest again..."
update_response=$(curl -s -X PATCH -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" -H "Accept: application/vnd.github.v3+json" \
-d "{\"make_latest\": \"true\"}" \
"$API_URL/repos/$GITHUB_ACTION_REPOSITORY/releases/$current_latest_id")
"$API_URL/repos/$GITHUB_REPOSITORY/releases/$current_latest_id")

log "Update response:"
echo "$update_response" | jq
Expand Down

0 comments on commit fd2b045

Please sign in to comment.