Skip to content

Commit

Permalink
chore: add github action for preview releases
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinHerber committed Nov 3, 2023
1 parent b3771b4 commit 07b9da7
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish Preview Betsy Web Components

on:
push:
branches:
- preview

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

permissions:
contents: write

jobs:
publish:
name: Publish Preview
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.CI_USER_BETSY }}

- name: Setup pnpm
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598

- name: Setup Node with pnpm Cache
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Run pnpm Install
run: pnpm i

- name: Run publish
run: pnpm publish

- name: Commit changes
run: |
git config --global user.name 'Betsy CI'
git config --global user.email '[email protected]'
git commit -am "Automated report"
git push
15 changes: 14 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

permissions:
contents: write

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.semantic-release.outputs.tag }}
url: ${{ steps.semantic-release.outputs.url }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -33,4 +39,11 @@ jobs:
run: pnpm i

- name: Semantic Release
run: pnpm run semantic-release
run: |
pnpm run semantic-release >> semantic-release.log
echo "url=$(cat semantic-release.log | grep -o 'https.*/tag/.*' | tr -d '\n')" >> $GITHUB_OUTPUT
echo "tag=$(cat semantic-release.log | grep -o '/tag/.*' | tr -d '/tag/')" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.CI_USER_BETSY }}
GIT_AUTHOR_NAME: ci-betsy
GIT_AUTHOR_EMAIL: [email protected]

0 comments on commit 07b9da7

Please sign in to comment.