Build and Minify Library #63
Workflow file for this run
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 Minify Library | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
release: | |
types: | |
- created | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20.x" | |
- name: Install dependencies | |
run: npm install | |
- name: Build and minify | |
run: npm run build | |
- name: Archive dist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: g-calendar-fetcher-minified | |
path: dist/g-calendar-fetcher.min.js | |
- name: Create Release | |
if: startsWith(github.event.ref, 'refs/tags/v') # Only run for tags | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
body: | | |
Release of version ${{ github.ref_name }} | |
## Breaking changes | |
**[v0.4.0]** | |
- Events are now sorted the other way around. Future events are now at the top. | |
- ical.js is now bundled with the library. You no longer need to include it separately. | |
- name: Upload Minified Library to Release | |
if: startsWith(github.event.ref, 'refs/tags/v') # Only run for tags | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/g-calendar-fetcher.min.js | |
asset_name: g-calendar-fetcher.min.js | |
asset_content_type: application/javascript | |
- name: Publish to npm | |
if: startsWith(github.event.ref, 'refs/tags/v') # Only run for version tags | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} |