From 64825c41695a951fc207d6989c63c4bcc4adaa80 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 31 Mar 2023 16:25:53 +0200 Subject: [PATCH 1/2] improve CI - Ensure that we use a the cache modules consistently - Ensure that `npm run build` is executed (which generates the types) - Make CI jobs consistent between workflows --- .github/workflows/nodejs.yml | 13 +++------ .github/workflows/prepare-release.yml | 40 +++++++++++--------------- .github/workflows/release-insiders.yml | 19 ++++++------ .github/workflows/release.yml | 25 ++++++---------- 4 files changed, 39 insertions(+), 58 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 9be3c9c..9882461 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -28,21 +28,16 @@ jobs: node-version: ${{ matrix.node-version }} - name: Use cached node_modules - id: cache uses: actions/cache@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('./package.json') }}-${{ matrix.node-version }} - restore-keys: | - nodeModules- + key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }} - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' run: npm install - env: - CI: true + + - name: Build + run: npm run build - name: Test run: npm test - env: - CI: true diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 0ec76a4..bf796a7 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -15,7 +15,7 @@ permissions: jobs: prepare: permissions: - contents: write # for softprops/action-gh-release to create GitHub release + contents: write # for softprops/action-gh-release to create GitHub release runs-on: ubuntu-latest @@ -31,16 +31,21 @@ jobs: with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - # cache: 'npm' - # - # - name: Use cached node_modules - # id: cache - # uses: actions/cache@v3 - # with: - # path: node_modules - # key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }} - # restore-keys: | - # nodeModules- + + - name: Use cached node_modules + uses: actions/cache@v3 + with: + path: node_modules + key: nodeModules-${{ hashFiles('**/package.json') }}-${{ matrix.node-version }} + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Test + run: npm test - name: Resolve version id: vars @@ -54,20 +59,9 @@ jobs: echo "$RELEASE_NOTES" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV - - name: Install dependencies - # if: steps.cache.outputs.cache-hit != 'true' - run: npm install - env: - CI: true - - - name: Test - run: npm test - env: - CI: true - - name: Release uses: softprops/action-gh-release@v1 with: draft: true tag_name: ${{ env.TAG_NAME }} - body: ${{ env.RELEASE_NOTES }} + body: ${{ env.RELEASE_NOTES }} diff --git a/.github/workflows/release-insiders.yml b/.github/workflows/release-insiders.yml index c6ced95..e50ab5d 100644 --- a/.github/workflows/release-insiders.yml +++ b/.github/workflows/release-insiders.yml @@ -22,30 +22,29 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Use cached node_modules - id: cache uses: actions/cache@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('**/package.json') }}-${{ matrix.node-version }} - restore-keys: | - nodeModules- + key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }} - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' run: npm install - env: - CI: true + + - name: Build + run: npm run build + + - name: Test + run: npm test - name: Resolve version id: vars - run: | + run: | echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - name: "Version based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}" + - name: 'Version based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}' run: npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version - name: Publish run: npm publish --tag insiders env: - CI: true NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67d7f37..be9b2b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,27 +23,21 @@ jobs: with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - # cache: 'npm' - # - # - name: Use cached node_modules - # id: cache - # uses: actions/cache@v3 - # with: - # path: node_modules - # key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }} - # restore-keys: | - # nodeModules- + + - name: Use cached node_modules + uses: actions/cache@v3 + with: + path: node_modules + key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }} - name: Install dependencies - # if: steps.cache.outputs.cache-hit != 'true' run: npm install - env: - CI: true + + - name: Build + run: npm run build - name: Test run: npm test - env: - CI: true - name: Calculate environment variables run: | @@ -52,5 +46,4 @@ jobs: - name: Publish run: npm publish --tag ${{ env.RELEASE_CHANNEL }} env: - CI: true NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 9b5f8017a7fa0975ccc0a6a09dc6c955aaf31cb2 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 31 Mar 2023 16:30:52 +0200 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57071b4..74426e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Ensure types are published to npm ([#11](https://github.com/tailwindlabs/tailwindcss-container-queries/pull/11)) ## [0.1.0] - 2022-10-19