diff --git a/.github/workflows/dco-exception.yaml b/.github/workflows/dco-exception.yaml new file mode 100644 index 0000000..ad7b395 --- /dev/null +++ b/.github/workflows/dco-exception.yaml @@ -0,0 +1,12 @@ +name: DCO +on: + merge_group: + +permissions: # set top-level default permissions as security best practice + contents: read # Check https://github.com/ossf/scorecard/blob/7ce8609469289d5f3b1bf5ee3122f42b4e3054fb/docs/checks.md#token-permissions + +jobs: + DCO: + runs-on: ubuntu-latest + steps: + - run: echo "skipping DCO check for the merge group" \ No newline at end of file diff --git a/.github/workflows/pr-lint.yaml b/.github/workflows/pr-lint.yaml new file mode 100644 index 0000000..d82ac41 --- /dev/null +++ b/.github/workflows/pr-lint.yaml @@ -0,0 +1,47 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + contents: read + +jobs: + main: + permissions: + pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs + statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + id: lint_pr_title + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: marocchino/sticky-pull-request-comment@v2 + # When the previous steps fails, the workflow would stop. By adding this + # condition you can continue the execution with the populated error message. + if: always() && (steps.lint_pr_title.outputs.error_message != null) + with: + header: pr-title-lint-error + message: | + Hey there and thank you for opening this pull request! ๐Ÿ‘‹๐Ÿผ + + We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete a previous comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + delete: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d7fffd2 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,91 @@ +name: Run Release + +on: + push: + branches: + - main + +permissions: + contents: read + + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + release-please: + runs-on: ubuntu-latest + permissions: + contents: write # for googleapis/release-please-action to create release commit + pull-requests: write # for googleapis/release-please-action to create release PR + # Release-please creates a PR that tracks all changes + steps: + - uses: google-github-actions/release-please-action@v3 + id: release + with: + command: manifest + token: ${{secrets.RELEASE_PLEASE_ACTION_TOKEN}} + default-branch: main + signoff: "OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>" + - name: Dump Release Please Output + env: + RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }} + run: | + echo "$RELEASE_PLEASE_OUTPUT" + outputs: + release_created: ${{ steps.release.outputs.release_created }} + release_tag_name: ${{ steps.release.outputs.tag_name }} + upload_url: ${{ steps.release.outputs.upload_url }} + + release: + needs: release-please + if: ${{ fromJSON(needs.release-please.outputs.release_created || false) }} + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ needs.release-please.outputs.release_tag_name }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64 + + - name: Build and Push Container + uses: docker/build-push-action@v6 + with: + push: true + provenance: mode=max + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..b985ff6 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1" +} diff --git a/Dockerfile b/Dockerfile index 4dacb9f..6f0950c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,8 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static USER nextjs +LABEL org.opencontainers.image.source=https://github.com/open-feature/toggle-shop + EXPOSE 3000 ENV PORT=3000 diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..bf81e69 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,67 @@ +{ + "release-type": "simple", + "packages": { + ".": { + "monorepo-tags": false, + "include-component-in-tag": false, + "prerelease": false, + "bump-minor-pre-major": false, + "bump-patch-for-minor-pre-major": false + } + }, + "changelog-sections": [ + { + "type": "fix", + "section": "๐Ÿ› Bug Fixes" + }, + { + "type": "feat", + "section": "โœจ New Features" + }, + { + "type": "chore", + "section": "๐Ÿงน Chore" + }, + { + "type": "docs", + "section": "๐Ÿ“š Documentation" + }, + { + "type": "perf", + "section": "๐Ÿš€ Performance" + }, + { + "type": "build", + "hidden": true, + "section": "๐Ÿ› ๏ธ Build" + }, + { + "type": "deps", + "section": "๐Ÿ“ฆ Dependencies" + }, + { + "type": "ci", + "hidden": true, + "section": "๐Ÿšฆ CI" + }, + { + "type": "refactor", + "section": "๐Ÿ”„ Refactoring" + }, + { + "type": "revert", + "section": "๐Ÿ”™ Reverts" + }, + { + "type": "style", + "hidden": true, + "section": "๐ŸŽจ Styling" + }, + { + "type": "test", + "hidden": true, + "section": "๐Ÿงช Tests" + } + ], + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +}