From 58872edd9620f683c0ceba50ae082b23a6cdfde8 Mon Sep 17 00:00:00 2001 From: fabidick22 Date: Wed, 6 Jul 2022 23:31:04 -0500 Subject: [PATCH] ci: Add CD workflow to generate semantic version --- .github/workflows/cd-semver.yml | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/cd-semver.yml diff --git a/.github/workflows/cd-semver.yml b/.github/workflows/cd-semver.yml new file mode 100644 index 0000000..262913e --- /dev/null +++ b/.github/workflows/cd-semver.yml @@ -0,0 +1,63 @@ +name: Continuous Delivery + +on: + push: + branches: + - main + - add-semver-workflow + +jobs: + release: + if: contains(github.event.commits[0].message, 'chore(release)') == false + name: Release + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + DRY_RUN: true + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Release + id: release + uses: ridedott/release-me-action@v3 + with: + dry-run: ${{ env.DRY_RUN }} + release-branches: '["main", "add-semver-workflow"]' + commit-assets: | + ./dist + release-rules-append: | + [ + { "release": "patch", "type": "build" }, + { "release": "patch", "type": "chore" }, + { "release": false, "type": "chore", "scope": "deps-dev" }, + { "release": "patch", "type": "chore", "scope": "deps-dev", "subject": "bump @zeit/ncc from*" }, + { "release": "patch", "type": "ci" }, + { "release": "patch", "type": "improvement" }, + { "release": "patch", "type": "refactor" }, + { "release": false, "subject": "*\\[skip release\\]*" } + ] + + - name: Authenticate + if: steps.release.outputs.released == 'true' + uses: actions/checkout@v3 + with: + fetch-depth: 1 + persist-credentials: true + token: ${{ secrets.DOTTBOTT_TOKEN }} + + - uses: actions/checkout@v3 + if: steps.release.outputs.released == 'true' + with: + fetch-depth: 1 + persist-credentials: true + + - name: Tag + if: steps.release.outputs.released == 'true' && env.DRY_RUN == 'false' + run: | + git push origin :refs/tags/'v${{ steps.release.outputs.major }}' + git tag 'v${{ steps.release.outputs.major }}' --force + git push --tags