Test i18n and versioning #456
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: Build and Deploy | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.17.1' | |
cache: 'yarn' | |
- name: Install Dependencies π¦ | |
run: yarn install --immutable | |
- name: Build Packages π¨ | |
run: yarn build:packages | |
- name: Build Website π¨ | |
run: yarn build:website | |
env: | |
DEPLOY_PRIME_URL: https://rohit-gohri.github.io/ | |
DEPLOY_BASE_URL: /redocusaurus/ | |
- name: Deploy π | |
uses: JamesIves/github-pages-deploy-action@4.1.3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: website/build | |
clean: true # Automatically remove deleted files from the deploy branch | |
git-config-email: drone@rohit.page | |
git-config-name: Drone User | |
if: ${{ github.event_name == 'push' }} | |
publish-test: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'push' && github.head_ref != 'changeset-release/main' }} | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.17.1' | |
cache: 'yarn' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Dependencies π¦ | |
run: yarn install --immutable | |
- name: Build Packages π¨ | |
run: yarn build:packages | |
- name: Generate snapshot versions | |
run: yarn changeset version --snapshot test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get version | |
run: | | |
yarn workspace redocusaurus exec "sh $PWD/scripts/version.sh" >> $GITHUB_ENV | |
- name: Publish | |
run: yarn changeset publish --tag test | |
if: ${{ env.publish == 'yes' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Add comment | |
if: ${{ env.publish == 'yes' }} | |
uses: thollander/actions-comment-pull-request@v1 | |
with: | |
message: | | |
This pull request is automatically built and it is testable by installing [redocusaurus@v${{ env.package_version }}](https://www.npmjs.com/package/redocusaurus/v/${{ env.package_version }}). | |
For commit [${{ github.sha }}](https://github.com/rohit-gohri/redocusaurus/commit/${{ github.sha }}). | |
comment_includes: 'This pull request is automatically built and it is testable by installing' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |