Add bun-types release to canary workflow

This commit is contained in:
Ashcon Partovi
2023-02-01 14:13:39 -08:00
parent 02fc87ea29
commit f7a93fe294
2 changed files with 47 additions and 60 deletions

View File

@@ -30,6 +30,53 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
npm-types:
name: Release types to NPM
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/bun-types
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v3
- id: setup-env
name: Setup Environment
run: |
SHA=$(git rev-parse --short "$GITHUB_SHA")
TAG="${{ github.event.inputs.tag }}"
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
TAG="${TAG}-canary.$(date '+%Y%m%d').1+${SHA}"
echo "Setup tag: ${TAG}"
echo "TAG=${TAG}" >> ${GITHUB_ENV}
- id: setup-node
name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: latest
- id: setup-bun
name: Setup Bun
uses: oven-sh/setup-bun@v0.1.8
with:
bun-version: canary
github-token: ${{ secrets.GITHUB_TOKEN }}
- id: bun-install
name: Install Dependencies
run: |
bun upgrade --canary
bun install
- id: bun-run
name: Build
run: bun run build
env:
BUN_VERSION: ${{ env.TAG }}
- id: npm-publish
name: Release
uses: JS-DevTools/npm-publish@v1
with:
package: packages/bun-types/dist/package.json
token: ${{ secrets.NPM_TOKEN }}
tag: canary
docker:
name: Release to Dockerhub
runs-on: ubuntu-latest

View File

@@ -1,60 +0,0 @@
name: Release bun-types@canary
on:
push:
branches: [main]
paths:
- 'packages/bun-types/**'
jobs:
tests:
name: Build, test, publish canary
runs-on: ubuntu-latest
if: github.repository_owner == 'oven-sh'
defaults:
run:
working-directory: packages/bun-types
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: latest
- name: Install Bun
uses: oven-sh/setup-bun@v0.1.8
with:
bun-version: canary
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: bun install
- name: Generate package
run: bun run build
- name: Tests
run: bun run test
- name: Set temp version
working-directory: packages/bun-types/dist
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
new_pkg_version="$(bun --version)-canary.${git_hash}"
echo "new_pkg_version"
echo "${new_pkg_version}"
npm version ${new_pkg_version} --no-git-tag-version
- name: Publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
package: packages/bun-types/dist/package.json
token: ${{ secrets.NPM_BUN_TYPES_TOKEN }}
# dry-run: true
tag: canary
# - name: Publish on NPM
# working-directory: packages/bun-types/dist
# run: npm publish --access public --tag canary # --dry-run
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NODE_AUTH_TOKEN: ${{ secrets.NPM_BUN_TYPES_TOKEN }}