diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml new file mode 100644 index 00000000..8ef57b1b --- /dev/null +++ b/.github/workflows/Build.yml @@ -0,0 +1,45 @@ +name: Build, Test, List + +concurrency: deployment + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + Setup-Environment: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [ 18.x ] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: yarn install --frozen-lockfile + + Build: + runs-on: ubuntu-latest + needs: [Setup-Environment] + steps: + - run: yarn build + + Test: + runs-on: ubuntu-latest + needs: [ Setup-Environment ] + steps: + - run: yarn test + + Lint: + runs-on: ubuntu-latest + needs: [ Setup-Environment ] + steps: + - run: | + yarn format:check + yarn lint diff --git a/.github/workflows/commitlint.yml b/.github/workflows/Commitlint.yml similarity index 96% rename from .github/workflows/commitlint.yml rename to .github/workflows/Commitlint.yml index 56d3a25e..a377f83a 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/Commitlint.yml @@ -5,7 +5,7 @@ on: branches: [main] jobs: - build: + check-commit-message: runs-on: ubuntu-latest strategy: matrix: diff --git a/.github/workflows/Deploy.yml b/.github/workflows/Deploy.yml deleted file mode 100644 index b0eeb1e8..00000000 --- a/.github/workflows/Deploy.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Deploy Workflow - -concurrency: deployment - -on: - push: - branches: [main] - -jobs: - build: - runs-on: ubuntu-latest - environment: deployment - strategy: - matrix: - node-version: [18.x] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: '0' - - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - scope: '@spotify-confidence' - - run: yarn install --frozen-lockfile - - run: yarn build - - run: yarn test - - run: yarn format:check - - run: yarn lint - - run: | - git config user.name github-release-bot - git config user.email github-actions@github.com - - run: yarn release --yes - - name: Authenticate with Registry - run: | - echo "@spotify-confidence:registry=https://registry.npmjs.org/" > .npmrc - echo "registry=https://registry.npmjs.org/" >> .npmrc - echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> .npmrc - - run: yarn publish-if-missing - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml deleted file mode 100644 index ee4704a3..00000000 --- a/.github/workflows/PR.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: PR Workflow - -on: - pull_request: - branches: [main] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x] - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - run: yarn - - run: yarn format:check - - run: yarn lint - - run: yarn build - - run: yarn test diff --git a/.github/workflows/Release-Please.yml b/.github/workflows/Release-Please.yml new file mode 100644 index 00000000..5be1bfca --- /dev/null +++ b/.github/workflows/Release-Please.yml @@ -0,0 +1,67 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: Run Release Please +jobs: + release-please: + runs-on: ubuntu-latest + environment: deployment + strategy: + matrix: + node-version: [ 18.x ] + steps: + - uses: google-github-actions/release-please-action@v2 + id: release + with: + command: manifest + token: ${{secrets.GITHUB_TOKEN}} + default-branch: main + monorepo-tags: true + + + Setup-Environment: + runs-on: ubuntu-latest + if: ${{ steps.release.outputs.releases_created }} + strategy: + matrix: + node-version: [ 18.x ] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: yarn install --frozen-lockfile + + Build: + runs-on: ubuntu-latest + if: ${{ steps.release.outputs.releases_created }} + needs: [ Setup-Environment ] + steps: + - run: yarn build + + npm-publish: + runs-on: ubuntu-latest + if: ${{ steps.release.outputs.releases_created }} + needs: [Build] + strategy: + matrix: + node-version: [ 18.x ] + steps: + - name: Publish to NPM + if: ${{ steps.release.outputs.releases_created }} + env: + NPM_TOKEN: ${{secrets.NPM_TOKEN}} + run: | + echo "@spotify-confidence:registry=https://registry.npmjs.org/" > .npmrc + echo "registry=https://registry.npmjs.org/" >> .npmrc + echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> .npmrc + yarn publish-if-missing diff --git a/lerna.json b/lerna.json index 5d3937a4..93d74a40 100644 --- a/lerna.json +++ b/lerna.json @@ -3,6 +3,7 @@ "version": "independent", "packages": ["packages/*"], "npmClient": "yarn", + "tagVersionPrefix": "-v", "command": { "version": { "conventionalCommits": true,