Skip to content

Commit

Permalink
Updated build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
philpotisk committed Feb 25, 2023
1 parent f5f5a3c commit b7cc4e3
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 139 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

0 comments on commit b7cc4e3

Please sign in to comment.