Skip to content

Commit

Permalink
fix publish gh workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Jan 7, 2025
1 parent cd89c66 commit 33a619b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: demo
on:
push:
branches:
- state-refactor
- master

permissions:
contents: write
Expand Down
81 changes: 12 additions & 69 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,25 @@
name: publish

permissions:
contents: write

on:
push:
tags:
- v*

jobs:
install:
name: Installs and configures nix
publish:
runs-on: ubuntu-latest
steps:
- name: Checkouts code
uses: actions/checkout@v2

- name: Sets up Node for registry only
uses: actions/setup-node@v3
with:
node-version: '18.17'
registry-url: 'https://registry.npmjs.org'

- name: Caches Nix store
uses: actions/cache@v3
id: nix-cache
with:
path: /tmp/nix-cache
key: nix-${{ hashFiles('**/flake.*') }}

- name: Caches Node modules
uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: '**/node_modules'
key: yarn-${{ hashFiles('**/yarn.lock') }}

- name: Installs Nix
uses: cachix/install-nix-action@v22
path: node_modules
key: yarn-${{ hashFiles('yarn.lock') }}
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-23.05
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Imports Nix store cache
if: ${{ steps.nix-cache.outputs.cache-hit == 'true' }}
run: nix-store --import < /tmp/nix-cache

- name: Installs deps
run: nix develop -c yarn install --frozen-lockfile --immutable

- name: Exports Nix store cache
if: ${{ steps.nix-cache.outputs.cache-hit != 'true' }}
run: nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nix-cache

- name: Builds lib
working-directory: lib
run: nix develop -c yarn build

- name: Copies README to the lib folder
run: cp README.md LICENSE lib/

- name: Publishes the lib
working-directory: lib
run: |
nix develop --impure
yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Builds the demo
working-directory: demo
run: nix develop -c yarn build
nix_path: nixpkgs=channel:nixos-24.11
enable_kvm: true
- run: nix-shell --run 'yarn install --frozen-lockfile --immutable'
- run: nix-shell --run 'yarn build'
- run: nix-shell --run 'yarn publish --access public'
env:
PUBLIC_URL: /react-pin-field

- name: Deploys the demo
uses: jamesives/[email protected]
with:
branch: gh-pages
folder: demo/build
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 33a619b

Please sign in to comment.