Skip to content

Commit

Permalink
feat: initial release via semantic release 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
denniseffing committed Mar 11, 2022
1 parent 38c5e08 commit 0f26075
Show file tree
Hide file tree
Showing 30 changed files with 11,309 additions and 183 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/auth-keycloak.yaml

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
image-name:
required: true
type: string
version:
required: true
type: string
working-dir:
required: true
type: string
Expand Down Expand Up @@ -32,7 +35,8 @@ jobs:
run: |
docker build \
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest" \
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" .
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" \
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}" .
- name: 🔑 Login to GitHub Container registry
uses: docker/login-action@v1
with:
Expand All @@ -44,3 +48,4 @@ jobs:
run: |
docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest"
docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)"
docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}"
28 changes: 21 additions & 7 deletions .github/workflows/build-java-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@ on:
service_name:
required: true
type: string
version:
required: false
type: string
outputs:
artifact-name:
value: ${{ jobs.build.outputs.artifact-name }}
artifact-path:
value: ${{ jobs.build.outputs.artifact-path }}
jar-artifact-name:
value: ${{ jobs.build.outputs.jar-artifact-name }}
jar-artifact-path:
value: ${{ jobs.build.outputs.jar-artifact-path }}
license-artifact-name:
value: ${{ jobs.build.outputs.license-artifact-name }}
license-artifact-path:
value: ${{ jobs.build.outputs.license-artifact-path }}

jobs:
build:
name: 🔨 Build and test service
runs-on: ubuntu-latest
outputs:
artifact-name: ${{ inputs.service_name }}-jar
artifact-path: ./services/${{ inputs.service_name }}/build/libs/
jar-artifact-name: ${{ inputs.service_name }}-jar
jar-artifact-path: ./services/${{ inputs.service_name }}/build/libs/
license-artifact-name: ${{ inputs.service_name }}-license
license-artifact-path: ./services/${{ inputs.service_name }}/build/distributions
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v2
Expand All @@ -30,13 +39,18 @@ jobs:
- name: 🏗 Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build generateLicenseReport
arguments: build -Pversion=${{ inputs.version }} generateLicenseReport
build-root-directory: services/${{ inputs.service_name }}
- name: 📦 Upload JAR
uses: actions/upload-artifact@v2
with:
name: ${{ inputs.service_name }}-jar
path: ./services/${{ inputs.service_name }}/build/libs/${{ inputs.service_name }}-*.jar
- name: 📦 Upload license report
uses: actions/upload-artifact@v2
with:
name: ${{ inputs.service_name }}-license
path: ./services/${{ inputs.service_name }}/build/distributions/license-report.zip
- name: 📦 Upload test results
uses: actions/upload-artifact@v2
if: always()
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,48 @@ on:
branches:
- '**'
paths:
- .github/workflows/prepare-release.yaml
- .github/workflows/build-java-service.yaml
- .github/workflows/parse-junit-results.yaml
- .github/workflows/build-docker.yaml
- .github/workflows/release.yaml
- .github/workflows/gateway.yaml
- services/gateway

jobs:
prepare-release:
uses: ./.github/workflows/prepare-release.yaml
with:
working-dir: ./services/gateway

build:
uses: ./.github/workflows/build-java-service.yaml
needs: prepare-release
with:
service_name: gateway
version: ${{ needs.prepare-release.outputs.release-version }}

docker:
uses: ./.github/workflows/build-docker.yaml
needs: build
needs:
- prepare-release
- build
with:
image-name: gateway
working-dir: ./services/gateway
artifact-name: ${{ needs.build.outputs.artifact-name }}
artifact-path: ${{ needs.build.outputs.artifact-path }}
version: ${{ needs.prepare-release.outputs.release-version }}
artifact-name: ${{ needs.build.outputs.jar-artifact-name }}
artifact-path: ${{ needs.build.outputs.jar-artifact-path }}

github-release:
uses: ./.github/workflows/release.yaml
needs:
- prepare-release
- build
- docker
with:
service-name: gateway
version: ${{ needs.prepare-release.outputs.release-version }}
change-notes: ${{ needs.prepare-release.outputs.release-notes }}
license-artifact-name: ${{ needs.build.outputs.license-artifact-name }}
license-artifact-path: ${{ needs.build.outputs.license-artifact-path }}
32 changes: 29 additions & 3 deletions .github/workflows/habit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,48 @@ on:
branches:
- '**'
paths:
- .github/workflows/prepare-release.yaml
- .github/workflows/build-java-service.yaml
- .github/workflows/parse-junit-results.yaml
- .github/workflows/build-docker.yaml
- .github/workflows/release.yaml
- .github/workflows/habit.yaml
- services/habit

jobs:
prepare-release:
uses: ./.github/workflows/prepare-release.yaml
with:
working-dir: ./services/habit

build:
uses: ./.github/workflows/build-java-service.yaml
needs: prepare-release
with:
service_name: habit
version: ${{ needs.prepare-release.outputs.release-version }}

docker:
uses: ./.github/workflows/build-docker.yaml
needs: build
needs:
- prepare-release
- build
with:
image-name: habit
working-dir: ./services/habit
artifact-name: ${{ needs.build.outputs.artifact-name }}
artifact-path: ${{ needs.build.outputs.artifact-path }}
version: ${{ needs.prepare-release.outputs.release-version }}
artifact-name: ${{ needs.build.outputs.jar-artifact-name }}
artifact-path: ${{ needs.build.outputs.jar-artifact-path }}

github-release:
uses: ./.github/workflows/release.yaml
needs:
- prepare-release
- build
- docker
with:
service-name: habit
version: ${{ needs.prepare-release.outputs.release-version }}
change-notes: ${{ needs.prepare-release.outputs.release-notes }}
license-artifact-name: ${{ needs.build.outputs.license-artifact-name }}
license-artifact-path: ${{ needs.build.outputs.license-artifact-path }}
53 changes: 52 additions & 1 deletion .github/workflows/lpt-locust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,63 @@ on:
- '**'
paths:
- .github/workflows/lpt-locust.yaml
- .github/workflows/prepare-release.yaml
- .github/workflows/build-docker.yaml
- .github/workflows/release.yaml
- test/lpt-locust

jobs:
build:
prepare-release:
uses: ./.github/workflows/prepare-release.yaml
with:
working-dir: ./test/lpt-locust

license-report:
name: 📋 Generate license report
runs-on: ubuntu-latest
outputs:
license-artifact-name: license-report
license-artifact-path: ./test/lpt-locust/license-report
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v2
- name: 🏗 Setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: 'test/lpt-locust/requirements.txt'
- name: 👨🏻‍💻 Install dependencies
run: pip install -r test/lpt-locust/requirements.txt
- name: 📋 Generate license report
working-directory: ./test/lpt-locust
run: |
pip-licenses --with-license-file \
--format html --with-notice-file --no-license-path >licenses.html
- name: 📦 Upload license report
uses: actions/upload-artifact@v2
with:
name: license-report
path: ./test/lpt-locust/licenses.html

docker:
uses: ./.github/workflows/build-docker.yaml
needs:
- prepare-release
with:
image-name: lpt-locust
working-dir: ./test/lpt-locust
version: ${{ needs.prepare-release.outputs.release-version }}

github-release:
uses: ./.github/workflows/release.yaml
needs:
- prepare-release
- license-report
- docker
with:
service-name: lpt-locust
version: ${{ needs.prepare-release.outputs.release-version }}
change-notes: ${{ needs.prepare-release.outputs.release-notes }}
license-artifact-name: ${{ needs.license-report.outputs.license-artifact-name }}
license-artifact-path: ${{ needs.license-report.outputs.license-artifact-path }}
43 changes: 43 additions & 0 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
workflow_call:
inputs:
working-dir:
required: true
type: string
outputs:
release-version:
value: ${{ jobs.prepare-release.outputs.version }}
release-notes:
value: ${{ jobs.prepare-release.outputs.notes }}

jobs:
prepare-release:
name: 🛫 Prepare release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.prepare-release.outputs.version }}
notes: ${{ steps.prepare-release.outputs.notes }}
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v2
- name: 🏗 Setup node env
uses: actions/setup-node@v2
with:
node-version: lts/*
cache-dependency-path: package-lock.json
- name: 👨🏻‍💻 Install dependencies
run: npm install
- name: 🛫 Prepare Release
id: prepare-release
working-directory: ${{ inputs.working-dir }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release-plus
version=$(cat release/version.txt)
notes=$(cat release/notes.md)
notes="${notes//'%'/'%25'}"
notes="${notes//$'\n'/'%0A'}"
notes="${notes//$'\r'/'%0D'}"
echo "::set-output name=version::$version"
echo "::set-output name=notes::$notes"
49 changes: 49 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on:
workflow_call:
inputs:
service-name:
required: true
type: string
version:
required: true
type: string
change-notes:
required: true
type: string
license-artifact-name:
required: false
type: string
license-artifact-path:
required: false
type: string

jobs:
release:
name: 🎉 Release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v2
- name: 📦 Download license artifact
uses: actions/download-artifact@v2
with:
name: ${{ inputs.license-artifact-name }}
path: ${{ inputs.license-artifact-path }}
- name: 🏷 Tag repository
uses: actions/github-script@v5
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ inputs.service-name }}-v${{ inputs.version }}',
sha: context.sha
})
- name: 🚀 Release
uses: softprops/action-gh-release@v1
with:
body: ${{ inputs.change-notes }}
fail_on_unmatched_files: false
files: ${{ inputs.license-artifact-path }}/*
tag_name: ${{ inputs.service-name }}-v${{ inputs.version }}
Loading

0 comments on commit 0f26075

Please sign in to comment.