This repository has been archived by the owner on Nov 10, 2024. It is now read-only.
add site release workflow #9
Workflow file for this run
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: Site Release Dry | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
jobs: | |
publish-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.sha }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Install Dependencies and Build | |
run: | | |
yarn install | |
yarn build | |
env: | |
GATSBY_PATH_PREFIX: ${{ github.event.repository.name }} | |
GATSBY_SNAP_ORIGIN: npm:@transeptor-labs/${{ github.event.repository.name }} | |
- name: Cache build artifacts | |
uses: actions/cache@v3 | |
id: cache-build | |
with: | |
path: | | |
./packages/snap/dist | |
./packages/site/public | |
./node_modules/.yarn-state.yml | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Dry Run Publish | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
npm publish ./packages/snap --access public --dry-run | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Confirm Dry Run | |
run: echo "Dry run completed successfully. Ready for actual publishing." | |
- name: Publish to npm | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
npm publish ./packages/snap --access public --dry-run | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Deploy to `gh-pages` branch | |
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./packages/site/public |