Skip to content

Commit

Permalink
fix(ci): release broken release process
Browse files Browse the repository at this point in the history
Release-As: 6.0.0
  • Loading branch information
paambaati authored Apr 26, 2024
2 parents 749a6d3 + 5c9d4de commit 746f1d2
Show file tree
Hide file tree
Showing 22 changed files with 3,879 additions and 5,453 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
uses: actions/checkout@v4

- name: setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 8
version: 9

- name: setup node.js
uses: actions/setup-node@v4
Expand All @@ -27,6 +27,9 @@ jobs:
- name: install dependencies
run: pnpm install

- name: check for lint and format errors
run: pnpm run biome:ci

- name: build typescript
run: pnpm run build --noEmit

Expand Down Expand Up @@ -62,9 +65,35 @@ jobs:
uses: actions/checkout@v4

- name: setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 9

- name: setup node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: install dependencies
run: pnpm install

- name: run tests
run: pnpm run test

coverage:
name: "Test Coverage"
runs-on: "ubuntu-latest"
needs: [tests]
if: ${{ github.event_name == 'push' }} # Publish coverage only for push commits, not PRs.
steps:
- name: checkout code
uses: actions/checkout@v4

- name: setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
version: 9

- name: setup node.js
uses: actions/setup-node@v4
Expand All @@ -79,7 +108,6 @@ jobs:
run: pnpm run coverage

- name: publish code coverage to code-climate (duh)
if: ${{ github.event_name == 'push' && matrix.os.index == 1 }} # Push coverage only once inside the matrix.
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: 3470adaf12ff7cecdfe5a968ae0e95d098b6ee58c340114e1e90d440ee9e66ab
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
- published
- created
- released
- rerequested

jobs:
publish:
Expand All @@ -21,7 +20,7 @@ jobs:
CREATE_MAJOR_VERSION_TAG: true
CREATE_MINOR_VERSION_TAG: true
CREATE_PATCH_VERSION_TAG: true
CLEAN_TARGETS: '.[!.]*,test,src,*.ts,*.json,CHANGELOG.md,_config.yml,.github,coverage,.nyc_output'
CLEAN_TARGETS: '.[!.]*,test,src,*.ts,*.json,CHANGELOG.md,_config.yml,.github,.tap'
BRANCH_NAME: 'releases/${MAJOR}/${MINOR}/${PATCH}'
env:
DEBUG: '*'
97 changes: 9 additions & 88 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,102 +6,23 @@ on:
tags:
- '!*'

jobs:
next-version:
name: Get next release version
runs-on: ubuntu-latest
outputs:
need-release: ${{ steps.need-release.outputs.result }}
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: setup node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: install dependencies
run: pnpm install

- name: install workflow script dependencies
run: pnpm add [email protected]

- name: find current latest release version
uses: pozetroninc/github-action-get-latest-release@master
id: last-release
with:
repository: ${{ github.repository }}
token: ${{ secrets.CUSTOM_GITHUB_PERSONAL_TOKEN }}

- name: find next release version
id: next-release
run: pnpm -s dlx semantic-release --dry-run
env:
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_PERSONAL_TOKEN }}

- name: print discovered versions
run: |
echo "Last release version = ${{ steps.last-release.outputs.release }}"
echo "Next release version = ${{ steps.next-release.outputs.new-release-version }}"
- name: check if we need a new release
uses: actions/github-script@v6
id: need-release
env:
LAST_RELEASE: ${{ steps.last-release.outputs.release }}
NEW_RELEASE: ${{ steps.next-release.outputs.new-release-version }}
with:
script: |
const semver = require('semver');
const lastRelease = process.env.LAST_RELEASE.replace(/^v/, '');
const newRelease = process.env.NEW_RELEASE.replace(/^v/, '');
return semver.gt(newRelease, lastRelease);
result-encoding: string

- name: print if we need a new release
run: |
echo "Need a new release = ${{ steps.need-release.outputs.result }}"
permissions:
contents: write
pull-requests: write

jobs:
release:
name: Cut a release on GitHub
runs-on: ubuntu-latest
needs: next-version
if: needs.next-version.outputs.need-release == 'true'
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: setup node.js
uses: actions/setup-node@v4
- name: make a new release PR
uses: google-github-actions/release-please-action@v4
id: release
with:
node-version: 20
cache: 'pnpm'

- name: install dependencies
run: pnpm install

- name: make a release on GitHub
run: pnpm -s dlx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_PERSONAL_TOKEN }}
GIT_AUTHOR_NAME: 'GP'
GIT_COMMITTER_NAME: 'GP'
GIT_AUTHOR_EMAIL: '[email protected]'
GIT_COMMITTER_EMAIL: '[email protected]'
token: ${{ secrets.CUSTOM_GITHUB_PERSONAL_TOKEN }}
config-file: .release-please-config.json
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
registry = "https://registry.npmjs.org/"
save-exact = true
fund = false
package-manager-strict = false
18 changes: 0 additions & 18 deletions .nycrc.json

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierrc.json

This file was deleted.

10 changes: 10 additions & 0 deletions .release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"release-type": "node",
"include-v-in-tag": true,
"include-component-in-tag": false
}
}
}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "5.0.0"
}
53 changes: 0 additions & 53 deletions .releaserc.json

This file was deleted.

Loading

0 comments on commit 746f1d2

Please sign in to comment.