Skip to content

Commit

Permalink
build: update release scripts
Browse files Browse the repository at this point in the history
See discussion: https://github.com/orgs/AlaskaAirlines/discussions/523

This code diff shows changes made to a YAML file named `testPublish.yml`
and a JSON file named `package.json`. The changes include adding a new
step `npm run build:test` in the `jobs` section of the YAML file and
modifying the `build` script in the JSON file to include new scripts
`build:test` and `build:release`.

See discussion: https://github.com/orgs/AlaskaAirlines/discussions/556

Here's a brief description of the changes:

1. `.github/settings.yml`: This file is used to configure GitHub repository settings.
   The changes made here include:
   - The branch protection rules that were previously applied to the `main` branch are
     now defined under a YAML anchor `default_protection`. This allows the same
     set of rules to be reused for multiple branches.
   - The `main` and `beta` branches are now using the `default_protection` rules.

2. `.github/workflows/testPublish.yml`: This file defines a GitHub Actions workflow.
   The changes made here include:
   - The workflow is now triggered on `push` and `pull_request` events not only for
     the `main` branch but also for the `beta` branch.
   - The `release` job now runs if the event is a `push` to either the `main`
     or `beta` branch.

3. `package.json`: This file is used to manage the project's dependencies, scripts,
   version and more. The changes made here include:
   - The `release` configuration now includes the `beta` branch in addition to the
     `main` branch. The `beta` branch is marked as `prerelease`. This means that
     releases on the `beta` branch will be marked as pre-releases.

Changes to be committed:
modified:   .github/settings.yml
modified:   .github/workflows/testPublish.yml
modified:   package.json
  • Loading branch information
blackfalcon committed Jun 22, 2024
1 parent 75437fe commit 0e37d2f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
9 changes: 8 additions & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repository:
allow_rebase_merge: true

branches:
- name: main
- &default_protection
# https://developer.github.com/v3/repos/branches/#update-branch-protection
# Branch Protection settings. Set to null to disable
protection:
Expand All @@ -51,6 +51,7 @@ branches:
dismiss_stale_reviews: true
# Blocks merge until code owners have reviewed.
require_code_owner_reviews: true
# Required. Require status checks to pass before merging. Set to null to disable
# Specify which users and teams can dismiss pull request reviews. Pass an empty dismissal_restrictions object to disable. User and team dismissal_restrictions are only available for organization-owned repositories. Omit this parameter for personal repositories.
dismissal_restrictions:
users: ["blackfalcon"]
Expand All @@ -67,6 +68,12 @@ branches:
# Prevent merge commits from being pushed to matching branches
required_linear_history: true

- name: main
<<: *default_protection

- name: beta
<<: *default_protection

# Labels: define labels for Issues and Pull Requests
labels:
- name: auro-nav
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/testPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: Test and publish
# events but only for the main branch
on:
push:
branches: [ main ]
branches: [ main, beta ]
pull_request:
branches: [ main ]
branches: [ main, beta ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand All @@ -25,10 +25,11 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- run: npm run build:test

release:
# Only release on push to main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || 'refs/heads/beta'
runs-on: ubuntu-latest
needs: test
steps:
Expand All @@ -39,7 +40,7 @@ jobs:
with:
node-version: 20
- run: npm ci
- run: npm run build
- run: npm run build:release
- uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
Expand Down
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@
},
"release": {
"branches": [
"main"
{
"name": "main"
},
{
"name": "beta",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
Expand Down Expand Up @@ -137,8 +143,10 @@
"web components"
],
"scripts": {
"build": "npm-run-all build:sass sass:render scssLint dist:js bundler postinstall build:api build:docs types",
"build:ci": "npm-run-all sweep build",
"build": "npm-run-all build:sass sass:render types",
"build:test": "npm-run-all test linters",
"build:release": "npm-run-all build build:test build:api build:docs bundler types postinstall",
"build:ci": "npm-run-all sweep build:release",
"build:api": "wca analyze 'src/auro-*.js' --outFiles docs/api.md",
"build:dev:assets": "npm-run-all build:sass:component postCss:component sass:render build:docs",
"build:docs": "node scripts/generateDocs.mjs",
Expand Down

0 comments on commit 0e37d2f

Please sign in to comment.