v0.1.0 (#46) #34
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 Workflow | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Check if version has been updated | |
id: version_check | |
uses: EndBug/version-check@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node.js | |
if: steps.version_check.outputs.changed == 'true' | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.16.1' | |
- name: Install pnpm | |
if: steps.version_check.outputs.changed == 'true' | |
run: npm install -g pnpm | |
- name: Install Dependencies | |
if: steps.version_check.outputs.changed == 'true' | |
run: pnpm install | |
- name: Build and Move Files | |
if: steps.version_check.outputs.changed == 'true' | |
run: | | |
VERSION=v${{steps.version_check.outputs.version}} pnpm build | |
mkdir -p "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}" | |
mv schema/* "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}" | |
mkdir -p "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/types" | |
mv types/* "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/types" | |
mkdir -p "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/examples" | |
mv examples/*.json "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/examples" | |
- name: Checkout Dist Branch | |
if: steps.version_check.outputs.changed == 'true' | |
run: | | |
git fetch origin dist | |
git checkout -b dist origin/dist | |
- name: Commit and Push Changes | |
if: steps.version_check.outputs.changed == 'true' | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git add . | |
git commit -m "Add build files for v${{ steps.version_check.outputs.version }}" | |
git push origin dist | |
- name: Create Release and Tag | |
if: steps.version_check.outputs.changed == 'true' | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v${{ steps.version_check.outputs.version }} | |
release_name: v${{ steps.version_check.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |