File tree Expand file tree Collapse file tree 3 files changed +114
-0
lines changed Expand file tree Collapse file tree 3 files changed +114
-0
lines changed Original file line number Diff line number Diff line change 1+ name : " Setup test environment"
2+ description : " "
3+ inputs : {}
4+ outputs : {}
5+ runs :
6+ using : " composite"
7+ steps :
8+ - uses : cachix/install-nix-action@v31
9+ with :
10+ install_url : https://releases.nixos.org/nix/nix-2.11.1/install
11+ - run : |
12+ source <(nix print-dev-env --show-trace)
13+ output_file="nix-env.txt"
14+
15+ # Clear the output file
16+ > $output_file
17+
18+ # Loop over each variable in the environment
19+ while IFS='=' read -r -d '' name value; do
20+ # Skip if the variable is a function or read-only or non-alphanumeric
21+ [[ "$(declare -p $name)" =~ "declare -[a-z]*r[a-z]* " ]] && continue
22+ [[ ! $name =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]] && continue
23+
24+ # Check if the variable value contains a newline
25+ if [[ "$value" != *$'\n'* ]]; then
26+ # It doesn't, so write the variable and its value (stripping quotes) to the file
27+ echo "${name}=${value//\"/}" >> $output_file
28+ fi
29+ done < <(env -0)
30+
31+ # useful for debugging what env is exported
32+ # cat nix-env.txt
33+ shell: bash
34+ - run : cat nix-env.txt >> "$GITHUB_ENV"
35+ shell : bash
36+
37+ - name : Get pnpm store directory
38+ id : pnpm-cache
39+ shell : bash
40+ run : |
41+ echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
42+
43+ - uses : actions/cache@v3
44+ name : Setup pnpm cache
45+ with :
46+ path : ${{ steps.pnpm-cache.outputs.STORE_PATH }}
47+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
48+ restore-keys : |
49+ ${{ runner.os }}-pnpm-store-
50+
51+ - name : Install dependencies
52+ shell : bash
53+ run : pnpm install
Original file line number Diff line number Diff line change 1+ name : Release
2+ on :
3+ push :
4+ branches :
5+ - main
6+ paths :
7+ - " package.json"
8+ workflow_dispatch :
9+
10+ jobs :
11+ test :
12+ uses : ./.github/workflows/test.yml
13+ release :
14+ needs : test
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v2
18+ - uses : ./.github/actions/setup-test-env
19+ - id : npm-publish
20+ name : Publish to npm
21+ uses : JS-DevTools/npm-publish@v1
22+ with :
23+ token : ${{ secrets.NPM_TOKEN }}
24+ access : public
25+ - name : Publish release to github
26+ uses : softprops/action-gh-release@v1
27+ if : ${{ steps.npm-publish.outputs.type != 'none' }}
28+ with :
29+ tag_name : ${{ steps.npm-publish.outputs.version }}
30+ generate_release_notes : true
Original file line number Diff line number Diff line change 1+ name : " Test"
2+ on :
3+ push :
4+ workflow_call :
5+ jobs :
6+ test :
7+ runs-on : ubuntu-latest
8+ steps :
9+ 10+ - uses : ./.github/actions/setup-test-env
11+ - name : Test
12+ shell : bash
13+ run : pnpm test
14+
15+ lint :
16+ runs-on : ubuntu-latest
17+ steps :
18+ 19+ - uses : ./.github/actions/setup-test-env
20+ - name : Lint
21+ shell : bash
22+ run : pnpm lint
23+
24+ build-js :
25+ runs-on : ubuntu-latest
26+ steps :
27+ 28+ - uses : ./.github/actions/setup-test-env
29+ - name : Build
30+ shell : bash
31+ run : pnpm build
You can’t perform that action at this time.
0 commit comments