Skip to content

Commit

Permalink
Add release.yml will stick with zod-openapis copied release model 😅
Browse files Browse the repository at this point in the history
  • Loading branch information
avra-m3 committed Dec 28, 2023
1 parent c242182 commit f6d7672
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 8 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Prerelease
name: Canary Release 🚚

on:
pull_request:
release:
types:
- prereleased

permissions: {}

Expand Down Expand Up @@ -29,13 +31,13 @@ jobs:
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout -b beta
git push --force origin beta --set-upstream
git checkout -b canary
git push --force origin canary --set-upstream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Version Package
run: yarn version --new-version ${{ github.event.release.tag_name }} --git-tag-version=false
run: yarn version --new-version ${{ github.event.release.tag_name }}

- name: Push package.json and tags
run: |
Expand All @@ -50,9 +52,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_TO_COMMIT: package.json
DESTINATION_BRANCH: beta
DESTINATION_BRANCH: canary

- name: Publish to npm
run: yarn build && npm publish --provenance --tag beta
run: yarn build && npm publish --provenance --tag canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release 🚀

on:
release:
types:
- released

permissions: {}

jobs:
release:
name: Version & Publish
permissions:
contents: write
pull-requests: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Create Release Branch
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout -b release
git push --force origin release --set-upstream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Version Package
run: npm version ${{ github.event.release.tag_name }} --git-tag-version=false

- name: Push package.json and tags
run: |
sha=$(gh api --method PUT /repos/:owner/:repo/contents/$FILE_TO_COMMIT \
-f message="Release ${{ github.event.release.tag_name }}" \
-f content="$( base64 -i $FILE_TO_COMMIT )" \
-f encoding="base64" \
-f branch="$DESTINATION_BRANCH" \
-f sha="$( git rev-parse $DESTINATION_BRANCH:$FILE_TO_COMMIT )" --jq '.commit.sha')
gh api --method PATCH /repos/:owner/:repo/git/refs/tags/${{ github.event.release.tag_name }} \
-f sha="$sha" -F force=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_TO_COMMIT: package.json
DESTINATION_BRANCH: release

- name: Raise Release PR
run: |
gh pr create -H release -B master --title "Release ${{ github.event.release.tag_name }}" --body "Please merge this with a Merge Request to update master<br><br>[${{ github.event.release.tag_name }}](${{ github.event.release.html_url }})<br><br>${{ github.event.release.body }}" -l "chore"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to npm
run: yarn build && npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ full end-to-end examples of how express-haste works.
### Roadmap
* [X] Request Handler typing.
* [ ] Improve test coverage.
* [ ] Lint and Test checking in github actions.
* [X] Lint and Test checking in github actions.
* [ ] Tests for typing (it's very fragile and hard to catch all edge cases manually).
* [ ] Explore whether typing can be made less complicated.
* [ ] Ability to pass many parameters into one query, header, etc function call. ie; `query({q1: z.string(), q2: z.string()})`.
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
"src/index.ts"
],
"compilerOptions": {
"allowJs": false,
"target": "esnext",
"module": "commonjs",
"declaration": true,
"declarationMap": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
Expand Down

0 comments on commit f6d7672

Please sign in to comment.