diff --git a/.github/workflows/release-poller.yml b/.github/workflows/release-poller.yml deleted file mode 100644 index 9b8ce66..0000000 --- a/.github/workflows/release-poller.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release poller - -on: - schedule: - - cron: '*/15 * * * *' - workflow_dispatch: - -permissions: - actions: write - contents: read - -jobs: - check: - runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ secrets.RELEASE_SCHEDULER_TOKEN || secrets.GITHUB_TOKEN }} - steps: - - name: Check pending release - run: | - target=$(gh variable get PENDING_RELEASE_AT --repo "${{ github.repository }}" 2>/dev/null || echo "") - if [ -z "$target" ]; then - echo "No release scheduled." - exit 0 - fi - - now_epoch=$(date -u +%s) - target_epoch=$(date -d "$target" -u +%s) - if [ "$now_epoch" -lt "$target_epoch" ]; then - mins_left=$(( (target_epoch - now_epoch) / 60 )) - echo "Release scheduled for $target — $mins_left min remaining." - exit 0 - fi - - echo "::notice::Scheduled time reached ($target). Dispatching release." - gh workflow run release.yml --repo "${{ github.repository }}" --ref test - gh variable delete PENDING_RELEASE_AT --repo "${{ github.repository }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a923937..a70f9e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: with: fetch-depth: 0 ref: test - token: ${{ secrets.RELEASE_SCHEDULER_TOKEN }} + token: ${{ secrets.RELEASE_TOKEN }} - name: Verify main is ancestor of test run: | diff --git a/.github/workflows/schedule-release.yml b/.github/workflows/schedule-release.yml deleted file mode 100644 index 70ca321..0000000 --- a/.github/workflows/schedule-release.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Schedule a release - -on: - workflow_dispatch: - inputs: - release_at: - description: 'When to release — local datetime (YYYY-MM-DD HH:MM), interpreted in the timezone below' - required: true - timezone: - description: 'Timezone for release_at' - required: true - default: 'America/Chicago' - type: choice - options: - - America/Chicago - - America/New_York - - America/Los_Angeles - - America/Denver - - UTC - action: - description: 'Action' - required: true - default: 'schedule' - type: choice - options: - - schedule - - cancel - - show - -permissions: - actions: write - contents: read - # Needed to read/write repository variables via gh api - # Requires GITHUB_TOKEN with repo admin, OR a PAT stored as RELEASE_SCHEDULER_TOKEN - -jobs: - manage-schedule: - runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ secrets.RELEASE_SCHEDULER_TOKEN || secrets.GITHUB_TOKEN }} - steps: - - name: Show current schedule - if: ${{ inputs.action == 'show' }} - run: | - current=$(gh variable get PENDING_RELEASE_AT --repo "${{ github.repository }}" 2>/dev/null || echo "") - if [ -z "$current" ]; then - echo "::notice::No release scheduled." - else - echo "::notice::Release scheduled for: $current (UTC)" - fi - - - name: Cancel scheduled release - if: ${{ inputs.action == 'cancel' }} - run: | - gh variable delete PENDING_RELEASE_AT --repo "${{ github.repository }}" 2>/dev/null || true - echo "::notice::Scheduled release canceled." - - - name: Schedule release - if: ${{ inputs.action == 'schedule' }} - run: | - local_input="${{ inputs.release_at }}" - tz="${{ inputs.timezone }}" - - # Parse local datetime in the chosen timezone, convert to UTC ISO8601 - utc_iso=$(TZ="$tz" date -d "$local_input" -u +"%Y-%m-%dT%H:%M:%SZ") || { - echo "::error::Could not parse '$local_input'. Use format: YYYY-MM-DD HH:MM" - exit 1 - } - - now_epoch=$(date -u +%s) - target_epoch=$(date -d "$utc_iso" -u +%s) - if [ "$target_epoch" -le "$now_epoch" ]; then - echo "::error::Scheduled time is in the past: $utc_iso" - exit 1 - fi - - gh variable set PENDING_RELEASE_AT --body "$utc_iso" --repo "${{ github.repository }}" - - human_local=$(TZ="$tz" date -d "$utc_iso" +"%Y-%m-%d %H:%M %Z") - echo "::notice::Release scheduled for $human_local ($utc_iso UTC)"