Skip to content

Commit

Permalink
chore: add CI environment variables to release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
carlmw committed Feb 27, 2024
1 parent 468d0e1 commit 6098c62
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: Release
on:
workflow_run:
workflows: Verify
branches: main
types: completed
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read # for checkout

jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Release
runs-on: ubuntu-latest
permissions:
Expand All @@ -35,4 +32,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
CI: true
run: npx semantic-release
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if [ "$CI" == "true" ]; then
echo "Skipping pre-commit hook in CI"
exit 0
fi

npm run format:precommit
npm run lint:precommit
npm run check-types
7 changes: 6 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if [ "$CI" == "true" ]; then
echo "Skipping pre-push hook in CI"
exit 0
fi

git diff-index --quiet HEAD -- || (echo "Error: You have uncommitted changes. Please commit or stash them before pushing." && exit 1)

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "main" ]; then
if [ "$branch" = "main" ]; then
echo "Main Branch push is blocked"
exit 1
fi
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
"homepage": "https://github.com/oaknational/oak-components#readme",
"release": {
"branches": [
"main"
"main",
"next"
],
"plugins": [
"@semantic-release/commit-analyzer",
Expand Down

0 comments on commit 6098c62

Please sign in to comment.