Merge pull request #32 from nicholasM95/renovate/github.com-nicholasm… #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- develop | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
JAVA_VERSION: '21' | |
REGISTRY: ghcr.io | |
IMAGE_NAME: nicholasm95/api-skoda | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Set up JDK | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: 'liberica' | |
cache: 'maven' | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4.0.2 | |
with: | |
node-version: 20 | |
- name: Install Semantic Release and plugins | |
run: | | |
npm install semantic-release @semantic-release/exec @semantic-release/changelog @semantic-release/github | |
- name: Log in to the Container registry | |
uses: docker/login-action@70fccc794acd729b2b22dd6a326895f286447728 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Calculate next version | |
run: | | |
npx semantic-release --dry-run --no-ci | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SKIP_UPDATE_VERSION_IN_POM: true | |
- name: Build with Maven Wrapper | |
run: ./mvnw install | |
- name: Create Docker image | |
run: ./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(cat .image_tag) -DskipTests | |
- name: Docker push | |
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(cat .image_tag) | |
- name: Create Release | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update CHANGELOG.md | |
if: github.ref == 'refs/heads/main' | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add CHANGELOG.md | |
git commit -m "docs(CHANGELOG): Update CHANGELOG.md" | |
git push origin main | |
- name: Update develop branch | |
if: github.ref == 'refs/heads/main' | |
run: | | |
git fetch origin | |
git checkout develop | |
git merge --ff-only origin/main | |
git push origin develop |