chore: generate CHANGELOG.md & do sparse-checkout on changelog gen #2
Workflow file for this run
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: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
changelog: | |
permissions: | |
contents: write | |
name: Changelog generation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: CHANGELOG.md | |
fetch-depth: 0 | |
- name: Git Cliff CHANGELOG generation | |
uses: orhun/git-cliff-action@v3 | |
with: | |
config: cliff.toml | |
args: -o CHANGELOG.md | |
- name: Git Cliff generation | |
uses: orhun/git-cliff-action@v3 | |
id: git-cliff | |
with: | |
config: cliff.toml | |
args: -vv --latest --strip header | |
env: | |
OUTPUT: CHANGELOG.md | |
- name: Uploade release changes | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: ${{ steps.git-cliff.outputs.content }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
set +e | |
git add CHANGELOG.md | |
git commit -m "Update changelog" | |
git push | |
build-push: | |
needs: changelog | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: johnnys318/htwr-aachen | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=ref,event=push | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to dockerhub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Build & Push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request'}} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels}} | |
file: "docker/production/Dockerfile" |