This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
🚀 Continuous deployment #642
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: 🚀 Continuous deployment | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
version: | |
type: choice | |
description: Version | |
required: true | |
options: | |
- patch | |
- minor | |
- major | |
env: | |
NODE_VERSION: 18 | |
REGISTRY_URL: 'https://registry.npmjs.org' | |
GIT_USER_NAME: tokenstreet-tools | |
GIT_USER_EMAIL: [email protected] | |
jobs: | |
deploy_website: | |
name: 🌐 Deploy website | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: 🛑 Cancel Previous Runs | |
uses: styfle/[email protected] | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: ${{ env.REGISTRY_URL }} | |
- name: 📥 Download deps | |
run: | | |
yarn install --frozen-lockfile | |
yarn install --cwd website --frozen-lockfile | |
yarn build | |
yarn install --cwd examples/bare --frozen-lockfile | |
yarn install --cwd examples/expo --frozen-lockfile | |
- run: yarn --cwd website build | |
# Popular action to deploy to GitHub Pages: | |
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# Build output to publish to the `gh-pages` branch: | |
publish_dir: ./website/build | |
# The following lines assign commit authorship to the official | |
# GH-Actions bot for deploys to `gh-pages` branch: | |
# https://github.com/actions/checkout/issues/13#issuecomment-724415212 | |
# The GH actions bot is used by default if you didn't specify the two fields. | |
# You can swap them out with your own user credentials. | |
user_name: ${{ env.GIT_USER_NAME }} | |
user_email: ${{ env.GIT_USER_EMAIL }} | |
publish_package: | |
name: ⬆️ Publish package | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' | |
steps: | |
- name: 🛑 Cancel Previous Runs | |
uses: styfle/[email protected] | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN_TOOLS_TOKENSTREET }} | |
- name: Set git credentials | |
run: | | |
git config --global user.name "${{ env.GIT_USER_NAME }}" | |
git config --global user.email "${{ env.GIT_USER_EMAIL }}" | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: ${{ env.REGISTRY_URL }} | |
- name: 📥 Download deps | |
run: | | |
yarn install --frozen-lockfile | |
yarn install --cwd website --frozen-lockfile | |
yarn build | |
yarn install --cwd examples/bare --frozen-lockfile | |
yarn install --cwd examples/expo --frozen-lockfile | |
- run: yarn version --${{ github.event.inputs.version }} | |
- run: git push --follow-tags | |
- run: yarn publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |