chore: enhance project maintenance and migrate to MUI v5 (#30) #24
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: Release workflow | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| check-changes: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 # We only need the current and the previous commit | |
| - name: Check if the package.version has changed | |
| id: check_changes | |
| run: | | |
| if git diff --unified=0 HEAD^ package.json | grep '"version":'; then | |
| echo "changes=detected" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=none" >> $GITHUB_OUTPUT | |
| fi | |
| outputs: | |
| changes: ${{ steps.check_changes.outputs.changes }} | |
| release: | |
| runs-on: ubuntu-latest | |
| if: needs.check-changes.outputs.changes == 'detected' | |
| defaults: | |
| run: | |
| shell: nix develop --command bash {0} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: DeterminateSystems/nix-installer-action@main | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - uses: DeterminateSystems/flake-checker-action@main | |
| - name: Install dependencies | |
| run: | | |
| yarn install --immutable | |
| - name: Build | |
| run: | | |
| yarn tsc | |
| yarn build | |
| - name: Configure yarn for publishing | |
| run: | | |
| yarn config set -H 'npmAuthToken' "${{secrets.NPM_AUTH_TOKEN}}" | |
| - name: Release to GitHub releases | |
| run: errout=$(mktemp); gh release create $(cat package.json | jq -r .version) -R $GITHUB_REPOSITORY -t $(cat package.json | jq -r .version) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| GITHUB_REF: ${{ github.ref }} | |
| - name: Release to NPM | |
| run: yarn npm publish --access public |