Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: enable manual run of patch release #321

Merged
merged 9 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/scripts/prepare_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Fail on first error.
set -e

releaseLevel="$1"

oldVersion="$(node -pe 'require("./package.json").version')"
npx standard-version --release-as "$releaseLevel" --skip.commit=true --skip.tag=true
newVersion="$(node -pe 'require("./package.json").version')"

sed -i -e "s/ VERSION\\s*=\\s*\"$oldVersion\"/ VERSION = \"$newVersion\"/" version.rb
12 changes: 10 additions & 2 deletions .github/workflows/auto-patch-release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
name: Automatically create patch release every 2 weeks
on:
schedule:
# Run every Friday right before midnight
- cron: '59 23 * * 5'
# Run every Thursday right before midnight
- cron: '59 23 * * 4'
workflow_dispatch:
jobs:
create_patch_release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Determine if we skip cancel checks
id: skip-checks
shell: bash
# Skip checks if we are not a scheduled run
run: echo value=$(test ${{ github.event_name }} != schedule && echo true || echo false) >> "$GITHUB_OUTPUT"

- name: Create release
uses: dequelabs/axe-api-team-public/.github/actions/auto-patch-release-v1@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
skip_checks: ${{ steps.skip-checks.outputs.value }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you not do the expression here rather than having a separate step to do it?

Suggested change
skip_checks: ${{ steps.skip-checks.outputs.value }}
skip_checks: ${{ github.event_name != schedule }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the string true or false, so we use the output

project_token: ${{ secrets.GH_PROJECT_TOKEN }}
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
odd_release: 'true'
Expand Down