diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 9e295f4e7..628a8f59d 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -1,9 +1,7 @@ name: CI-Lint-And-Test on: - push: - branches: - - main + workflow_call: pull_request: types: [opened, synchronize, reopened] @@ -137,4 +135,3 @@ jobs: cargo install cargo-udeps --locked - name: Run cargo udeps run: cargo +nightly udeps --all-targets - \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..7e28a4947 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,37 @@ +name: Release +on: + push: + branches: + - main +permissions: + contents: read # for checkout +jobs: + lint-and-test: + uses: ./.github/workflows/lint-and-test.yml + + release: + name: Release + runs-on: large-8-core-32gb-22-04 + needs: [lint-and-test] + environment: deploy #!! DO NOT CHANGE THIS LINE !! # + permissions: + contents: write # to be able to publish a GitHub release + issues: write # to be able to comment on released issues + pull-requests: write # to be able to comment on released pull requests + id-token: write # to enable use of OIDC for npm provenance + steps: + - uses: actions/checkout@v4.1.0 + with: + fetch-depth: 0 # download tags, see https://github.com/actions/checkout/issues/100 + - run: git config --global --add safe.directory $(realpath .) + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: "20.x" + - name: Semantic Release + run: | + npm install semantic-release + npx semantic-release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + #CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} #TODO: add CRATES_TOKEN diff --git a/ci/build.sh b/ci/build.sh new file mode 100755 index 000000000..6a6ba66b2 --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +VERSION=${1?expected version as argument} +echo "Would build version $VERSION, but publishing is manual for now" \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 000000000..22a7d0190 --- /dev/null +++ b/package.json @@ -0,0 +1,56 @@ +{ + "name": "proof_of_sql", + "version": "0.0.0-development", + "devDependencies": { + "conventional-changelog-conventionalcommits": "^5.0.0", + "semantic-release": "^21.0.5" + }, + "release": { + "branches": [ + "main" + ], + "tagFormat": "v${version}", + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalCommits", + "releaseRules": [ + { "breaking": true, "release": "minor" }, + { "revert": true, "release": "patch" }, + { "type": "feat", "release": "patch" }, + { "type": "fix", "release": "patch" }, + { "type": "build", "release": "patch" }, + { "type": "docs", "release": "patch" }, + { "type": "chore", "release": "patch" }, + { "type": "bench", "release": "patch" }, + { "type": "perf", "release": "patch" }, + { "type": "refactor", "release": "patch" }, + { "type": "test", "release": "patch" }, + { "type": "ci", "release": "patch" } + ], + "parserOpts": { + "noteKeywords": [ + "BREAKING CHANGE", + "BREAKING CHANGES", + "BREAKING" + ] + } + } + ], + "@semantic-release/release-notes-generator", + [ + "@semantic-release/exec", + { + "prepareCmd": "bash ./ci/build.sh ${nextRelease.version}" + } + ], + [ + "@semantic-release/github" + ] + ] + }, + "dependencies": { + "@semantic-release/exec": "^6.0.3" + } +}