diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..4e57bda --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,11 @@ +changelog: + categories: + - title: New features + labels: + - enhancement + - title: Bugfixes + labels: + - bug + - title: Other changes + labels: + - '*' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8b4aff4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,73 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version_type: + description: 'Version bump type' + required: true + default: patch + type: choice + options: + - patch + - minor + - major + +concurrency: + group: release + cancel-in-progress: false + +jobs: + release: + name: Bump version and release + runs-on: ubuntu-latest + permissions: + contents: write + actions: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - run: npm ci + + - name: Lint + run: npm run lint + + - name: Test + run: | + cp lib/configuration/sample.config.json lib/configuration/prod.config.json + npm test + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Bump version, commit, tag + id: bump + run: | + NEW_VERSION=$(npm version ${{ inputs.version_type }} -m "%s") + echo "new_version=${NEW_VERSION}" >> "$GITHUB_OUTPUT" + + - name: Push commit and tag + run: git push --follow-tags origin master + + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "${{ steps.bump.outputs.new_version }}" \ + --title "${{ steps.bump.outputs.new_version }}" \ + --generate-notes + + - name: Trigger ECR build + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh workflow run ecr-chatbot-prod.yml --ref "${{ steps.bump.outputs.new_version }}"