@lpsmods/mc-utils v1.0.0 #6
Workflow file for this run
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: Publish Packages | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| registry-url: https://registry.npmjs.org | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Parse release tag | |
| id: tag | |
| run: | | |
| TAG="${{ github.event.release.tag_name }}" | |
| NAME="${TAG%%_v*}" | |
| VERSION="${TAG##*_v}" | |
| echo "name=$NAME" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Publish packages | |
| run: npx changeset publish | |
| - name: Build package | |
| run: | | |
| PKG=${{ steps.tag.outputs.name }} | |
| npm run build --workspace="$PKG" | |
| - name: Archive package | |
| run: | | |
| mkdir artifacts | |
| PKG_FULL=${{ steps.tag.outputs.name }} | |
| VERSION=${{ steps.tag.outputs.version}} | |
| PKG_NAME="${PKG_FULL#@*/}" | |
| tar -czf "artifacts/${PKG_NAME}_v${VERSION}.tar.gz" \ | |
| -C "libraries/$PKG_NAME" . | |
| - name: Collect release assets | |
| run: | | |
| PKG_FULL=${{ steps.tag.outputs.name }} | |
| PKG_NAME="${PKG_FULL#@*/}" | |
| mkdir -p release | |
| # copy tarball | |
| cp artifacts/*.tar.gz release/ | |
| # copy exact dist files | |
| cp "libraries/$PKG_NAME/dist/$PKG_NAME.js" release/ | |
| cp "libraries/$PKG_NAME/dist/$PKG_NAME.min.js" release/ | |
| - name: Upload release asset | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release/** | |