Merge remote-tracking branch 'origin/main' #940
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: Build on every push | |
on: | |
push: | |
branches: | |
- '*' | |
- '*/*' | |
- '**' | |
- '!main' | |
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/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
#- 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: Gradle Build and Publish | |
uses: gradle/gradle-build-action@v2 | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
with: | |
arguments: build publish | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{secrets.DOCKER_USERNAME}} | |
password: ${{secrets.DOCKER_PASSWORD}} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: waltid/ssikit:${{ env.release_version }} | |
- 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 |