diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..5b021ae --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Code owners for all files +* @minwork diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml new file mode 100644 index 0000000..ae0e1d8 --- /dev/null +++ b/.github/workflows/post-release.yml @@ -0,0 +1,67 @@ +name: Post Release + +permissions: + contents: read + +on: + push: + tags: + - "*@*.*.*" + +jobs: + extract-project: + name: Extract project name from git tag + runs-on: ubuntu-latest + outputs: + project: ${{ steps.extract-project-name.outputs.project }} + steps: + - name: Extract Project Name + id: extract-project-name + shell: bash + run: | + TAG_NAME=${{ github.ref_name }} + if [[ "$TAG_NAME" =~ ^(.+)@[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then + PROJECT_NAME=${BASH_REMATCH[1]} + else + PROJECT_NAME="" + fi + echo "project=$PROJECT_NAME" >> "$GITHUB_OUTPUT" + echo "Extracted project '$PROJECT_NAME' from '$TAG_NAME'" + + upload-test-coverage: + name: Upload tests coverage for project + runs-on: ubuntu-latest + needs: extract-project + if: ${{ needs.extract-project.outputs.project != '' }} + env: + PROJECT: ${{ needs.extract-project.outputs.project }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-tags: 'true' + fetch-depth: '0' + + - name: Enable Corepack + run: corepack enable + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: 'https://registry.npmjs.org/' + cache: 'yarn' + cache-dependency-path: 'yarn.lock' + + - name: Install dependencies + run: yarn install --immutable + + - name: Run tests with coverage + run: npx nx run ${{ env.PROJECT }}:test --coverage + + - name: Upload ${{ env.PROJECT }} coverage reports to Codecov + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: ./coverage/packages/${{ env.PROJECT }} + flags: ${{ env.PROJECT }} diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 41ed3e5..d824fe0 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -12,7 +12,7 @@ on: branches: ['main'] jobs: - build: + verify-pr: runs-on: ubuntu-latest strategy: @@ -62,24 +62,20 @@ jobs: json-summary-path: ../../coverage/packages/${{ matrix.package }}/coverage-summary.json json-final-path: ../../coverage/packages/${{ matrix.package }}/coverage-final.json - -# - name: Upload use-long-press coverage reports to Codecov -# uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 -# with: -# token: ${{ secrets.CODECOV_TOKEN }} -# directory: ./coverage/packages/use-long-press -# flags: hooks,use-long-press -# -# - name: Upload use-double-tap coverage reports to Codecov -# uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 -# with: -# token: ${{ secrets.CODECOV_TOKEN }} -# directory: ./coverage/packages/use-double-tap -# flags: hooks,use-double-tap -# -# - name: Upload react-interval-hook coverage reports to Codecov -# uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 -# with: -# token: ${{ secrets.CODECOV_TOKEN }} -# directory: ./coverage/packages/react-interval-hook -# flags: hooks,react-interval-hook + report-status: + name: Report PR verification status + runs-on: ubuntu-latest + needs: verify-pr + if: always() # Ensures it runs even if a matrix job fails + steps: + - name: Determine overall status + run: | + if [[ "${{ needs.verify-pr.result }}" == "success" ]]; then + echo "All matrix jobs passed ✅" + exit 0 + else + echo "Some matrix jobs failed ❌" + exit 1 + fi + outputs: + status: ${{ job.status }} diff --git a/nx.json b/nx.json index 1edd921..d86d008 100644 --- a/nx.json +++ b/nx.json @@ -97,7 +97,7 @@ "generatorOptions": { "fallbackCurrentVersionResolver": "disk" }, - "preVersionCommand": "yarn nx run-many -t build", + "preVersionCommand": "yarn nx run-many -t build" }, "changelog": { "projectChangelogs": true,