ci: rc deployment #31
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
name: Publish Package | |
# on: | |
# push: | |
# tags: | |
# - "*" | |
on: | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Bun | |
uses: oven-sh/setup-bun@v1 | |
- run: bun install | |
- run: bun run build | |
- name: Read package.json | |
id: package_version | |
# package-version | |
run: echo "::set-output name=package-version::$(node -p "require('./package.json').version")" | |
- name: Read rc version | |
id: read_commit | |
# rc-version | |
run: | | |
echo "Reading RC" | |
echo "::set-output name=rc-version::$(git log -1 --pretty=%H)" | |
echo ${{ steps.read_commit.outputs.rc-version }} | |
- name: Use the GitHub Token | |
run: echo "My GitHub token is ${{ secrets.GH_PAT }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
- name: Git | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
- name: Authenticate npm | |
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Tag release | |
run: | | |
echo "the package version would be" | |
echo ${{ steps.package_version.outputs.rc-version }} | |
# TODO tag release action | |
# git tag v${{ steps.package_version.outputs.rc-version }} | |
# git push origin v${{ steps.package_version.outputs.rc-version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Publish | |
run: | | |
npm publish --access public | |
echo ${{ secrets.NPM_AUTH_TOKEN }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |