chore: test deploy #3
This file contains hidden or 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: Deploy Openapi Assets | |
| on: | |
| push: | |
| branches: [feat-openapi-package] | |
| paths: | |
| - "packages/openapi/**" | |
| jobs: | |
| deploy-package: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| permissions: | |
| # needed to create/update releases and upload assets | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - id: pack | |
| name: Pack @docs/openapi | |
| run: | | |
| cd packages/openapi | |
| npm ci | |
| VERSION=$(node -p "require('./package.json').version") | |
| PACKFILE=$(npm pack | tail -n1) | |
| # copy tarball to a stable "latest" filename | |
| cp "$PACKFILE" "openapi-latest.tgz" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "packfile_name=$PACKFILE" >> $GITHUB_OUTPUT | |
| echo "tarball=$PWD/$PACKFILE" >> $GITHUB_OUTPUT | |
| echo "latest_tarball=$PWD/openapi-latest.tgz" >> $GITHUB_OUTPUT | |
| - name: Create or update release and upload tarball | |
| id: gh_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: "openapi-v${{ steps.pack.outputs.version }}" | |
| name: "openapi v${{ steps.pack.outputs.version }}" | |
| body: "Automated release for packages/openapi (pack + upload)" | |
| files: ${{ steps.pack.outputs.tarball }} ${{ steps.pack.outputs.latest_tarball }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| rebuild-schema: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| needs: | |
| - deploy-package | |
| steps: | |
| - name: Trigger autoupdate swagger | |
| env: | |
| GH_ORG_ACCESS_TOKEN: ${{ secrets.GH_ORG_ACCESS_TOKEN }} | |
| OPENAPI_REPO: ${{ secrets.OPENAPI_REPO }} | |
| run: | | |
| curl -X POST \ | |
| -H "Authorization: Bearer $GH_ORG_ACCESS_TOKEN" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| https://api.github.com/repos/$OPENAPI_REPO/dispatches \ | |
| -d '{"event_type":"api-docs-release"}' |