Skip to content

ci: enhance changelog update step with previous tag reference #123

ci: enhance changelog update step with previous tag reference

ci: enhance changelog update step with previous tag reference #123

name: Build and Release Process
on:
push:
branches:
- 'main'
- 'master'
repository_dispatch:
types: [build]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ['4.4', '5.0', '6.0', '7.0', '8.0']
java: [ '21', '23' ]
steps:
- uses: actions/checkout@main
- name: Setup TimeZone
uses: szenius/set-timezone@master
with:
timezoneLinux: "Europe/Berlin"
timezoneMacos: "Europe/Berlin"
timezoneWindows: "W. Europe Standard Time"
- name: Set up JDK ${{ matrix.Java }}
uses: coursier/setup-action@main
with:
jvm: corretto:${{ matrix.Java }}
apps: sbt scala scalac
- name: Start MongoDB ${{ matrix.mongodb-version }}
uses: MongoCamp/mongodb-github-action@main
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Run tests
run: |
timedatectl
sbt +test
release:
needs: test
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
token: ${{ secrets.GH_ADMIN_TOKEN }}
- id: install-secret-key
name: Install gpg secret key
run: cat <(echo -e "${{ secrets.PGP_SECRET_KEY }}") | gpg --batch --import
- name: Set up JDK
uses: coursier/setup-action@main
with:
jvm: corretto:17
apps: sbt scala scalac
- name: Release
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSWORD }}
PGP_SECRET: ${{ secrets.PGP_SECRET_KEY }}
run: |
git config --global user.email "ci@mongocamp.dev"
git config --global user.name "MongoCamp CI"
sbt ci-release
- name: Get previous tag
id: previousTag
run: |
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -1 | head -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
- name: Get from tag
id: fromTag
run: |
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -99 | head -1)
echo "fromTag: $name"
echo "fromTag=$name" >> $GITHUB_ENV
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@main
with:
token: ${{ github.token }}
tag: ${{ env.previousTag }}
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@master
with:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }}'
file_pattern: CHANGELOG.md