Skip to content

Commit

Permalink
Merge pull request #223 from walt-id/222-introduce-new-release-process
Browse files Browse the repository at this point in the history
222 introduce new release process
  • Loading branch information
philpotisk authored Feb 27, 2023
2 parents c4e5442 + b7cc4e3 commit 1915a97
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 150 deletions.
96 changes: 60 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,64 @@
name: CI/CD Workflow for walt.id SSI Kit
name: Build on every push

on:
push:
branches:
- master
pull_request:
branches:
- master
push:
branches:
- '*'
- '*/*'
- '**'
- '!main'

jobs:
verify-wrapper:
name: "Verification"
runs-on: "ubuntu-latest"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1

gradle:
needs: verify-wrapper
name: "Build"
strategy:
matrix:
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup java
uses: actions/[email protected]
with:
distribution: 'adopt-hotspot'
java-version: '16'
- name: Running gradle build
uses: eskatos/[email protected]
with:
arguments: build --no-daemon --info
jobs:
build:
name: "Build"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Calculate release version
run: |
echo "release_version=1.$(date +'%g%m%d%H%M').$(echo ${{ github.ref_name }} | tr / -)" >> $GITHUB_ENV
- name: Set version
run: |
sed -i "s/1.SNAPSHOT/${{ env.release_version }}/g" build.gradle.kts src/main/kotlin/id/walt/Values.kt
- run: |
git tag v${{ env.release_version }}
git push --tags
- name: Setup java
uses: actions/[email protected]
with:
distribution: 'adopt-hotspot'
java-version: '16'
- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle wrapper validation
uses: gradle/wrapper-validation-action@v1
- name: Running gradle build
uses: eskatos/[email protected]
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
with:
arguments: build publish --no-daemon
- name: Docker Build and Push SNAPSHOT
uses: philpotisk/github-action-docker-build-push@master
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
DOCKER_FILE: Dockerfile
CONTAINER_TAG: waltid/ssikit:latest
- name: Prepare CD K8S
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" k8s/deployment-dev.yaml > k8s/deployment-dev_mod.yaml
- name: Continuous deployment K8S
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with:
args: apply -n dev -f k8s/deployment-dev_mod.yaml
10 changes: 0 additions & 10 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

179 changes: 86 additions & 93 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,97 +1,90 @@
name: "Release"
name: Release on push to main

on:
workflow_dispatch:
inputs:
versionName:
description: 'Version name (1.2.3)'
required: true
push:
branches:
- main

jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Calc release version
run: |
echo "release_version=1.$(date +'%g%m%d%k')" >> $GITHUB_ENV
- name: Set version
run: |
sed -i "s/1.SNAPSHOT/${{ env.release_version }}/g" build.gradle.kts src/main/kotlin/id/walt/Values.kt ssikit.sh
- name: Setup java
uses: actions/[email protected]
with:
distribution: 'adopt-hotspot'
java-version: '16'

- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1

- name: Running gradle publish
uses: eskatos/[email protected]
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
with:
arguments: publish --no-daemon

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ github.event.inputs.versionName }}

- name: Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@v1
with:
version: ${{ github.event.inputs.versionName }}

- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: Automatic release commits for ${{ github.event.inputs.versionName }}
branch: master

- name: Docker Build and Push
uses: philpotisk/github-action-docker-build-push@master
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
DOCKER_FILE: Dockerfile
CONTAINER_TAG: waltid/ssikit:${{ github.event.inputs.versionName }}

- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
tag_name: ${{ github.event.inputs.versionName }}
files: |
LICENSE.txt
build/libs/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare CD K8S
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" k8s/deployment-prod.yaml > k8s/deployment-prod_mod.yaml
- name: Continuous deployment K8S
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_PROD }}
with:
args: apply -n default -f k8s/deployment-prod_mod.yaml
release:
name: "Release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Calculate release version
run: |
echo "release_version=1.$(date +'%g%m%d%H%M').0" >> $GITHUB_ENV
- name: Set version
run: |
sed -i "s/1.SNAPSHOT/${{ env.release_version }}/g" build.gradle.kts src/main/kotlin/id/walt/Values.kt
- run: |
git tag v${{ env.release_version }}
git push --tags
- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle wrapper validation
uses: gradle/wrapper-validation-action@v1
- name: Running gradle build
uses: eskatos/[email protected]
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
with:
arguments: build publish --no-daemon
- name: Docker build and push
uses: philpotisk/github-action-docker-build-push@master
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
DOCKER_FILE: Dockerfile
CONTAINER_TAG: waltid/ssikit:latest
- name: Changelog
uses: ardalanamini/auto-changelog@v3
id: changelog
with:
github-token: ${{ github.token }}
commit-types: |
breaking: Breaking Changes
feat: New Features
fix: Bug Fixes
revert: Reverts
perf: Performance Improvements
refactor: Refactors
deps: Dependencies
docs: Documentation Changes
style: Code Style Changes
build: Build System
ci: Continuous Integration
test: Tests
chore: Chores
other: Other Changes
default-commit-type: Other Changes
release-name: ${{ env.release_version }}
mention-authors: true
mention-new-contributors: true
include-compare: true
semver: true
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.release_version }}
body: |
${{ steps.changelog.outputs.changelog }}
prerelease: ${{ steps.changelog.outputs.prerelease }}
- name: Prepare CD K8S
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" k8s/deployment-prod.yaml > k8s/deployment-prod_mod.yaml
- name: Continuous deployment K8S
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_PROD }}
with:
args: apply -n default -f k8s/deployment-prod_mod.yaml
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ COPY --from=opa-env /opa /usr/local/bin/opa
COPY --from=iota-env /usr/local/lib/libwaltid_iota_identity_wrapper.so /usr/local/lib/libwaltid_iota_identity_wrapper.so
RUN ldconfig

COPY --from=build-env /appbuild/build/install/waltid-ssi-kit /app/
COPY --from=build-env /appbuild/build/install/waltid-ssikit /app/
COPY --from=build-env /appbuild/service-matrix.properties /app/
COPY --from=build-env /appbuild/config /app/config


### Execution
EXPOSE 7000 7001 7002 7003 7004 7010

ENTRYPOINT ["/app/bin/waltid-ssi-kit"]
ENTRYPOINT ["/app/bin/waltid-ssikit"]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
build: .
volumes:
- ./data:/app/data
entrypoint: /app/bin/waltid-ssi-kit serve -b 0.0.0.0
entrypoint: /app/bin/waltid-ssikit serve -b 0.0.0.0
ports:
- "7000:7000"
- "7001:7001"
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "waltid-ssi-kit"
rootProject.name = "waltid-ssikit"
14 changes: 7 additions & 7 deletions ssikit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

function header() {
echo "waltid-ssi-kit wrapper script"
echo "waltid-ssikit wrapper script"
echo
}

Expand Down Expand Up @@ -72,8 +72,8 @@ function build_runscript_question() {
}

function execute_debug() {
if [[ -f build/install/waltid-ssi-kit/bin/waltid-ssi-kit ]]; then
JAVA_OPTS="-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG" build/install/waltid-ssi-kit/bin/waltid-ssi-kit "$@"
if [[ -f build/install/waltid-ssikit/bin/waltid-ssikit ]]; then
JAVA_OPTS="-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG" build/install/waltid-ssikit/bin/waltid-ssikit "$@"
else
build_runscript_question

Expand All @@ -85,8 +85,8 @@ function execute_debug() {
}

function execute() {
if [[ -f build/install/waltid-ssi-kit/bin/waltid-ssi-kit ]]; then
build/install/waltid-ssi-kit/bin/waltid-ssi-kit "$@"
if [[ -f build/install/waltid-ssikit/bin/waltid-ssikit ]]; then
build/install/waltid-ssikit/bin/waltid-ssikit "$@"
else
build_runscript_question

Expand All @@ -104,8 +104,8 @@ function clean() {
function help() {
echo "Usage: $0 {build|build-st|build-docker|build-podman|extract|--verbose|execute (default)}"
echo
echo "Use \"execute\" to execute waltid-ssi-kit with no arguments. If you don't supply any"
echo "arguments of {build|build-st|build-docker|build-podman|extract}, waltid-ssi-kit will"
echo "Use \"execute\" to execute waltid-ssikit with no arguments. If you don't supply any"
echo "arguments of {build|build-st|build-docker|build-podman|extract}, waltid-ssikit will"
echo "be executed with the provided arguments."
}

Expand Down

0 comments on commit 1915a97

Please sign in to comment.