diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a7d8e6f..57af3e2 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,4 +1,4 @@ -name: Build and release - staging +name: Build and test - staging on: pull_request: diff --git a/.github/workflows/create-release-sdk.yml b/.github/workflows/create-release-sdk.yml new file mode 100644 index 0000000..31ac899 --- /dev/null +++ b/.github/workflows/create-release-sdk.yml @@ -0,0 +1,86 @@ +name: Build and release + +on: + push: + branches: + - main + +jobs: + build-and-test: + name: Build and test + runs-on: ubuntu-latest + environment: test + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Run tests + run: pnpm test + + semantic-release: + needs: build-and-test + if: "!contains(github.event.head_commit.message, '[skip ci]')" + + name: Semantic Release + runs-on: ubuntu-latest + environment: staging + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v4 + id: semantic # Need an `id` for output variables + with: + extra_plugins: | + @semantic-release/commit-analyzer + @semantic-release/release-notes-generator + @semantic-release/changelog + @semantic-release/github + @semantic-release/git + @semantic-release/npm + env: + GITHUB_TOKEN: ${{ secrets.GH_PA_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Do something when a new release published + if: steps.semantic.outputs.new_release_published == 'true' + run: | + echo ${{ steps.semantic.outputs.new_release_version }} + echo ${{ steps.semantic.outputs.new_release_major_version }} + echo ${{ steps.semantic.outputs.new_release_minor_version }} + echo ${{ steps.semantic.outputs.new_release_patch_version }} \ No newline at end of file diff --git a/.releaserc.prerelease.yaml b/.releaserc.prerelease.yaml index 1779894..4a1b392 100644 --- a/.releaserc.prerelease.yaml +++ b/.releaserc.prerelease.yaml @@ -16,5 +16,3 @@ branches: prerelease: '${name.replace(/^hotfix\//g, "fix-").replace(/\//g, "-")}' - name: fix/* prerelease: '${name.replace(/^fix\//g, "fix-").replace(/\//g, "-")}' - - name: feat/init - prerelease: 'beta'