Skip to content

Commit

Permalink
Merge pull request #336 from zimicjs/release/v0.9.0
Browse files Browse the repository at this point in the history
chore(release): v0.9.0
  • Loading branch information
diego-aquino authored Aug 20, 2024
2 parents 73d97e7 + 868baf3 commit 321242c
Show file tree
Hide file tree
Showing 108 changed files with 5,538 additions and 4,270 deletions.
1 change: 1 addition & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
[
"root",
"ci",
"wiki",
"release",
"zimic-test-client",
"#zimic",
Expand Down
48 changes: 48 additions & 0 deletions .github/actions/zimic-version/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Get zimic version
description: Get zimic version

inputs:
ref-name:
description: The tag name that triggered the workflow
required: true
working-directory:
description: The working directory to run the action in

outputs:
value:
description: The version of the zimic package
value: ${{ steps.zimic-version.outputs.value }}
label:
description: The label of the zimic package version
value: ${{ steps.zimic-label.outputs.value }}

runs:
using: composite
steps:
- name: Get zimic version
id: zimic-version
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
version=$(jq -r '.version' ./packages/zimic/package.json)
echo "value=$version" >> $GITHUB_OUTPUT
if [[ '${{ inputs.ref-name }}' != "v$version" ]]; then
echo 'The ref name does not match the package version.' >&2
exit 1
fi
- name: Get zimic label
id: zimic-label
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
# Check if the ref name is a valid semantic version.
if echo '${{ inputs.ref-name }}' | grep -qP '^v[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9-]+\.[0-9]+)?$'; then
# Extract the label of the ref name or use 'latest' as the default.
value=$(echo '${{ inputs.ref-name }}' | grep -oP '(?<=-)[a-z0-9-]+(?=\.[0-9]+$)' || echo latest)
echo "value=$value" >> $GITHUB_OUTPUT
else
echo "The ref name '${{ inputs.ref-name }}' is not valid." >&2
exit 1
fi
22 changes: 11 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,23 @@ jobs:
- name: Check if auto-generated types are in sync
run: |
cp \
./examples/with-typegen/src/types/github/typegen/generated.ts \
./examples/with-typegen/src/types/github/typegen/generated.current.ts
./examples/with-openapi-typegen/src/types/github/typegen/generated.ts \
./examples/with-openapi-typegen/src/types/github/typegen/generated.current.ts
pnpm --dir examples/with-typegen typegen:github
pnpm --dir examples style:format ./with-typegen/src/types/github/typegen/generated.ts
pnpm --dir examples/with-openapi-typegen typegen:github
pnpm --dir examples style:format ./with-openapi-typegen/src/types/github/typegen/generated.ts
if ! diff -u \
./examples/with-typegen/src/types/github/typegen/generated.ts \
./examples/with-typegen/src/types/github/typegen/generated.current.ts
./examples/with-openapi-typegen/src/types/github/typegen/generated.ts \
./examples/with-openapi-typegen/src/types/github/typegen/generated.current.ts
then
echo \
"[examples/with-typegen] Generated types are out of date." \
"Please run 'pnpm --dir examples/with-typegen typegen:github' and commit the changes." >&2
"[examples/with-openapi-typegen] Generated types are out of date." \
"Please run 'pnpm --dir examples/with-openapi-typegen typegen:github' and commit the changes." >&2
exit 1
else
rm ./examples/with-typegen/src/types/github/typegen/generated.current.ts
echo "[examples/with-typegen] Generated types are up to date."
rm ./examples/with-openapi-typegen/src/types/github/typegen/generated.current.ts
echo "[examples/with-openapi-typegen] Generated types are up to date."
fi
- name: Lint code and check types
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
filterOptionsOfPackagesUsingFastify=(
'--filter !zimic-example-with-jest-node'
'--filter !zimic-example-with-vitest-node'
'--filter !zimic-example-with-typegen'
'--filter !zimic-example-with-openapi-typegen'
)
filterOptionsOfPackagesUsingNext=(
Expand Down
41 changes: 15 additions & 26 deletions .github/workflows/release-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Get zimic release version
id: zimic-version
uses: ./.github/actions/zimic-version
with:
ref-name: ${{ github.ref_name }}

- name: Set up zimic
uses: ./.github/actions/zimic-setup
with:
Expand All @@ -38,34 +44,12 @@ jobs:
build: zimic^...
install-playwright-browsers: true

- name: Get zimic release version
id: zimic-version
run: |
version=$(jq -r '.version' ./packages/zimic/package.json)
echo "value=$version" >> $GITHUB_OUTPUT
- name: Build zimic
run: pnpm turbo build --filter zimic

- name: Prepare NPM tag
id: npm-tag
run: |
if [[ '${{ github.ref_name }}' != 'v${{ steps.zimic-version.outputs.value }}' ]]; then
echo 'The release tag does not match the package version.' >&2
exit 1
fi
if [[ '${{ github.ref_name }}' == v*.*.*-canary.* ]]; then
echo "value=canary" >> $GITHUB_OUTPUT
elif [[ '${{ github.ref_name }}' == v*.*.* ]]; then
echo "value=latest" >> $GITHUB_OUTPUT
else
echo "value=next" >> $GITHUB_OUTPUT
fi
- name: Release to NPM
working-directory: packages/zimic
run: pnpm publish --no-git-checks --tag ${{ steps.npm-tag.outputs.value }}
run: pnpm publish --no-git-checks --tag ${{ steps.zimic-version.outputs.label }}
env:
NODE_AUTH_TOKEN: ${{ secrets.ZIMIC_NPM_RELEASE_TOKEN }}
NPM_CONFIG_PROVENANCE: true
Expand All @@ -86,15 +70,20 @@ jobs:
timeout 60s bash -c '
until pnpm view zimic versions --json | grep --quiet "${{ steps.zimic-version.outputs.value }}"; do
echo "zimic@${{ steps.zimic-version.outputs.value }} is not available on NPM yet..."
echo "zimic@${{ steps.zimic-version.outputs.value }} is not yet available on NPM..."
sleep 5
echo "Checking if zimic@${{ steps.zimic-version.outputs.value }} is available on NPM..."
echo "Checking again..."
done
'
echo "zimic@${{ steps.zimic-version.outputs.value }} is now available on NPM!"
pnpm install --no-frozen-lockfile
timeout 180s bash -c '
until pnpm install --no-frozen-lockfile; do
sleep 5
echo "Retrying..."
done
'
pnpm turbo \
types:check lint:turbo \
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/release-wiki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release Wiki

on:
release:
types:
- published

concurrency:
group: release-wiki
cancel-in-progress: false

env:
NODE_VERSION: 20
TURBO_LOG_ORDER: stream

jobs:
release-zimic-wiki:
name: Release zimic to GitHub Wiki
runs-on: ubuntu-latest
timeout-minutes: 5

environment: Wiki

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: zimic

- name: Get zimic release version
id: zimic-version
uses: ./zimic/.github/actions/zimic-version
with:
ref-name: ${{ github.ref_name }}
working-directory: zimic

- name: Checkout wiki
uses: actions/checkout@v4
if: ${{ steps.zimic-version.outputs.label == 'latest' }}
with:
repository: zimicjs/zimic.wiki
path: zimic.wiki

- name: Sync wiki with markdown docs
if: ${{ steps.zimic-version.outputs.label == 'latest' }}
working-directory: zimic.wiki
run: |
git config user.name '${{ vars.ZIMIC_WIKI_COMMIT_USER_NAME }}'
git config user.email '${{ vars.ZIMIC_WIKI_COMMIT_USER_EMAIL }}'
bash scripts/sync.sh '${{ github.ref_name }}'
git add .
git commit -m 'docs(wiki): zimic@${{ steps.zimic-version.outputs.value }}'
git push
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:construction: This is still a work in progress.

See https://github.com/zimicjs/zimic/issues/18.
Loading

0 comments on commit 321242c

Please sign in to comment.