Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docker-build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:

jobs:
build-and-push:
# run only if a new version is detected and it is not a major version
if: ${{ inputs.version != '' && inputs.version != '0.0.0' && !endsWith(inputs.version, '.0.0') }}
runs-on: ubuntu-latest

steps:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/github-publish-draft-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Publish Draft Release

permissions:
contents: write

on:
workflow_call:
outputs:
VERSION:
value: ${{ jobs.publish_draft.outputs.VERSION }}

jobs:
publish_draft:
runs-on: ubuntu-latest

outputs:
VERSION: ${{ steps.clean_version.outputs.version }}

steps:
- name: Get latest draft release
id: get_draft
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
const releases = await github.rest.repos.listReleases({ owner, repo, per_page: 10 });
const draft = releases.data.find(r => r.draft);
if (!draft) {
core.setFailed('Kein Draft-Release gefunden – Abbruch.');
} else {
core.info(`Draft Release Version: ${draft.tag_name}`);
core.setOutput('release_id', draft.id);
core.setOutput('tag_name', draft.tag_name);
}

- name: Publish draft release
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const releaseId = parseInt('${{ steps.get_draft.outputs.release_id }}', 10);
console.log(`Veröffentliche Release ${{ steps.get_draft.outputs.tag_name }}`);
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
draft: false
});

- name: Remove 'v' prefix of tag_name
id: clean_version
run: |
VERSION=${{ steps.get_draft.outputs.tag_name }}; echo "version=${VERSION#v}" >> $GITHUB_OUTPUT

31 changes: 31 additions & 0 deletions .github/workflows/github-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish GitHub release

permissions:
contents: write

on:
workflow_call:
inputs:
VERSION:
required: true
type: string
RELEASE_NOTES:
required: true
type: string

jobs:
publish_gh_release:
# run only if a new version is detected
if: ${{ inputs.VERSION != '' && inputs.VERSION != '0.0.0' }}
runs-on: ubuntu-latest
steps:
- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ inputs.VERSION }}
name: v${{ inputs.VERSION }}
body: ${{ inputs.RELEASE_NOTES }}
# true if the version leads to a new major release (e.g., 2.0.0)
draft: ${{ endsWith(inputs.VERSION, '.0.0') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/semver-and-release-notes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Detect next version and generate release notes

on:
workflow_call:
outputs:
VERSION:
value: ${{ jobs.detect_version.outputs.VERSION}}
RELEASE_NOTES:
value: ${{ jobs.detect_version.outputs.RELEASE_NOTES }}

jobs:
detect_version:
runs-on: ubuntu-latest

outputs:
VERSION: ${{ steps.semver.outputs.new_release_version }}
RELEASE_NOTES: ${{ steps.semver.outputs.new_release_notes }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22' # latest LTS version

- name: Install dependencies
run: npm ci

- name: Detect next version and generate release notes
id: semver
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/template_CD-major.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Continuous Deployment (post compatibility check)

permissions:
contents: write

on:
workflow_dispatch:

jobs:
publish_draft_release:
uses: woped/devops/.github/workflows/github-publish-draft-release.yaml@main

docker_build_and_push:
uses: woped/devops/.github/workflows/docker-build-and-push.yaml@main
needs: publish_draft_release
with:
version: ${{ needs.publish_draft_release.outputs.VERSION }}
25 changes: 25 additions & 0 deletions .github/workflows/template_CD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Continuous Deployment

permissions:
contents: write

on:
push:
branches: [ main, master ]

jobs:
semver:
uses: woped/devops/.github/workflows/semver-and-release-notes.yaml@main

gh_release:
uses: woped/devops/.github/workflows/github-release.yaml@main
needs: semver
with:
VERSION: ${{ needs.semver.outputs.VERSION }}
RELEASE_NOTES: ${{ needs.semver.outputs.RELEASE_NOTES }}

docker_build_and_push:
uses: woped/devops/.github/workflows/docker-build-and-push.yaml@main
needs: semver
with:
version: ${{ needs.semver.outputs.VERSION }}
66 changes: 66 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"devDependencies": {
"conventional-changelog-conventionalcommits": "^9.0.0"
}
}
12 changes: 12 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
plugins: [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
};
3 changes: 3 additions & 0 deletions service-compatibility-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}