-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add structured release process
- Loading branch information
1 parent
38e0aaf
commit 2678266
Showing
13 changed files
with
235 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build | ||
on: | ||
workflow_call: | ||
inputs: | ||
workflow_artifact_name: | ||
description: Name of uploaded workflow artifact | ||
required: true | ||
type: string | ||
jobs: | ||
www: | ||
name: www | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup | ||
uses: ./.github/workflows/www/setup | ||
- name: Build | ||
# Linting is validated in separate workflow | ||
run: yarn build --no-lint | ||
working-directory: packages/www | ||
- name: Upload workflow artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.workflow_artifact_name }} | ||
path: packages/www/out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Deploy | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
component: | ||
description: Component | ||
options: | ||
- www | ||
required: true | ||
type: choice | ||
version: | ||
description: Version | ||
required: true | ||
type: string | ||
permissions: | ||
id-token: write | ||
pages: write | ||
jobs: | ||
prepare-artifact: | ||
name: Prepare Artifact | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Download release artifact | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh release download ${{ inputs.component }}-${{ inputs.version }} --dir artifacts --pattern '${{ inputs.component }}-${{ inputs.version }}.zip' | ||
- name: Extract artifact | ||
run: unzip ${{ inputs.component }}-${{ inputs.version }}.zip -d ${{ inputs.component }}-${{ inputs.version }} | ||
working-directory: artifacts | ||
- name: Upload workflow artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: artifacts/${{ inputs.component }}-${{ inputs.version }} | ||
deploy: | ||
name: Deploy | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deploy.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: prepare-artifact | ||
steps: | ||
- name: Deploy | ||
id: deploy | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Format | ||
on: | ||
workflow_call: | ||
jobs: | ||
www: | ||
name: www | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup | ||
uses: ./.github/workflows/www/setup | ||
- name: Check formatting | ||
run: yarn format:check | ||
working-directory: packages/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Lint | ||
on: | ||
workflow_call: | ||
jobs: | ||
www: | ||
name: www | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup | ||
uses: ./.github/workflows/www/setup | ||
- name: Check linting | ||
run: yarn lint:check | ||
working-directory: packages/www |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Pull Request | ||
on: | ||
pull_request: | ||
branches: | ||
- "!release-please*/*" | ||
jobs: | ||
format: | ||
name: Format | ||
uses: ./.github/workflows/format.yml | ||
lint: | ||
name: Lint | ||
uses: ./.github/workflows/lint.yml | ||
build: | ||
name: Build | ||
needs: [format, lint] | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
workflow_artifact_name: www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Push main | ||
on: | ||
push: | ||
branches: main | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
jobs: | ||
prepare-release: | ||
name: Prepare Release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
artifact_name: www-${{ steps.release.outputs['packages/www--major'] }}.${{ steps.release.outputs['packages/www--minor'] }}.${{ steps.release.outputs['packages/www--patch'] }} | ||
release_tag: ${{ steps.release.outputs['packages/www--tag_name'] }} | ||
releases_created: ${{ steps.release.outputs.releases_created }} | ||
steps: | ||
- name: Prepare release | ||
uses: google-github-actions/release-please-action@v4 | ||
id: release | ||
with: | ||
config-file: release-config.json | ||
manifest-file: release-manifest.json | ||
token: ${{ secrets.RELEASE_PLEASE_TOKEN }} | ||
format: | ||
name: Format | ||
needs: prepare-release | ||
if: needs.prepare-release.outputs.releases_created == 'true' | ||
uses: ./.github/workflows/format.yml | ||
lint: | ||
name: Lint | ||
needs: prepare-release | ||
if: needs.prepare-release.outputs.releases_created == 'true' | ||
uses: ./.github/workflows/lint.yml | ||
build: | ||
name: Build | ||
needs: [format, lint, prepare-release] | ||
if: needs.prepare-release.outputs.releases_created == 'true' | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
workflow_artifact_name: ${{ needs.prepare-release.outputs.artifact_name }} | ||
upload-release-artifact: | ||
name: Upload Release Artifact | ||
needs: [build, prepare-release] | ||
if: needs.prepare-release.outputs.releases_created == 'true' | ||
uses: ./.github/workflows/upload-release-artifact.yml | ||
with: | ||
artifact_name: ${{ needs.prepare-release.outputs.artifact_name }} | ||
release_tag: ${{ needs.prepare-release.outputs.release_tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Upload Release Artifact | ||
on: | ||
workflow_call: | ||
inputs: | ||
release_tag: | ||
description: Release tag to upload to | ||
required: true | ||
type: string | ||
workflow_artifact_name: | ||
description: Workflow artifact to upload | ||
required: true | ||
type: string | ||
jobs: | ||
www: | ||
name: www | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Download workflow artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.workflow_artifact_name }} | ||
path: ${{ inputs.workflow_artifact_name }} | ||
- name: Compress artifact | ||
run: (cd ${{ inputs.workflow_artifact_name }} && zip -r "$OLDPWD/${{ inputs.workflow_artifact_name }}.zip" .) | ||
- name: Upload release artifact | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh release upload ${{ inputs.release_tag }} ${{ inputs.workflow_artifact_name }}.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Setup | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: yarn | ||
cache-dependency-path: packages/www/yarn.lock | ||
node-version-file: packages/www/package.json | ||
- name: Restore Next.js build cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: packages/www/.next/cache | ||
# Generate a new cache whenever packages or source files change | ||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | ||
# If source files changed but packages didn't, rebuild from a prior cache | ||
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- | ||
- name: Install dependencies | ||
run: yarn install | ||
shell: bash | ||
working-directory: packages/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
.next | ||
|
||
CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"include-v-in-tag": false, | ||
"packages": { | ||
"packages/www": { | ||
"package-name": "www" | ||
} | ||
}, | ||
"pull-request-header": ":rocket: In the Next Release..." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"packages/www": "1.0.0" | ||
} |