From 11e44df7c08cc3565bd54d96cea9ea6088eb820c Mon Sep 17 00:00:00 2001 From: Shahar Dawn Or Date: Mon, 1 Aug 2022 13:27:58 +0700 Subject: [PATCH] ci: continuous delivery closes #840 Co-authored-by: Rostislav Simonik --- .github/workflows/ci.yaml | 18 ++++++++++++++++ .releaserc.yml | 44 +++++++++++++++++++++++++++++++++++++++ package.json | 3 +++ 3 files changed, 65 insertions(+) create mode 100644 .releaserc.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 080e41cb5..30b149062 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,6 +3,24 @@ on: push: {} jobs: + publish: + needs: ci + #if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: navikt/github-app-token-generator@v1 + id: get-token + with: + app-id: ${{ secrets.BOT_APP_ID }} + private-key: ${{ secrets.BOT_PRIVATE_KEY }} + - uses: actions/checkout@v3 + with: + persist-credentials: false # for later steps to use a different authentication + - run: npm install + - run: npx semantic-release --dry-run + env: + GITHUB_TOKEN: ${{ steps.get-token.outputs.token }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # The ci-matrix job ends up as multiple jobs and therefore as multiple checks. # Each check's name ends up with the node version appended. # If we were to use those checks as required checks, we would have to occasionally bump them. diff --git a/.releaserc.yml b/.releaserc.yml new file mode 100644 index 000000000..a303c5cec --- /dev/null +++ b/.releaserc.yml @@ -0,0 +1,44 @@ +branches: + - master +plugins: + - - "@semantic-release/commit-analyzer" + - releaseRules: + - breaking: true + release: major + - revert: true + release: patch + - type: feat + release: minor + - type: fix + release: patch + - type: perf + release: patch + - type: docs + release: patch + - - "@semantic-release/release-notes-generator" + - preset: conventionalcommits + presetConfig: + types: + - type: build + section: Build system / dependencies + - type: ci + section: CI + - type: docs + section: Documentation + - type: feat + section: Features + - type: fix + section: Bug fixes + - type: perf + section: Performance + - type: refactor + section: Refactoring + - type: test + section: Testing + - "@semantic-release/changelog" + - "@semantic-release/github" + - "@semantic-release/npm" + - - "@semantic-release/git" + - assets: + - CHANGELOG.md + - package.json diff --git a/package.json b/package.json index 8feacb3b6..12df3f6e1 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,8 @@ "@arkweid/lefthook": "0.7.7", "@commitlint/cli": "17.0.3", "@commitlint/config-conventional": "17.0.3", + "@semantic-release/changelog": "6.0.1", + "@semantic-release/git": "10.0.1", "@types/eslint": "8.4.5", "@types/js-yaml": "4.0.5", "@types/node": "18.6.3", @@ -86,6 +88,7 @@ "npm-run-all": "4.1.5", "read-pkg-up": "8.0.0", "runtypes": "6.5.1", + "semantic-release": "19.0.3", "semver": "7.3.7", "standard-version": "9.5.0", "tsconfigs": "5.0.0",