Update CI workflow: remove npm cache and switch to npm install #2
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: Build and Release | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| - name: Install dependencies | ||
| run: npm install | ||
| - name: Build project | ||
| run: npm run build | ||
| - name: Create dist archive | ||
| run: | | ||
| cd dist | ||
| zip -r ../dist.zip . | ||
| cd .. | ||
| - name: Generate release tag | ||
| id: tag | ||
| run: echo "tag=release-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT | ||
| - name: Create Release | ||
| id: create_release | ||
| uses: actions/create-release@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag_name: ${{ steps.tag.outputs.tag }} | ||
| release_name: Release ${{ steps.tag.outputs.tag }} | ||
| draft: false | ||
| prerelease: false | ||
| - name: Upload Release Asset | ||
| uses: actions/upload-release-asset@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
| asset_path: ./dist.zip | ||
| asset_name: dist.zip | ||
| asset_content_type: application/zip | ||
| asset_content_type: application/zip | ||