Merge pull request #144 from walt-id/improvments #59
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: Release on push to main | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
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/nftkit/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: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker images | |
uses: docker/[email protected] | |
with: | |
push: true | |
tags: waltid/nftkit:latest, waltid/nftkit:${{ env.release_version }} | |
- name: Build and push Docker images | |
uses: docker/[email protected] | |
with: | |
file: js/Dockerfile | |
push: true | |
tags: waltid/nftkit-js:latest, waltid/nftkit-js:${{ env.release_version }} | |
- 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: v${{ 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 prod CD | |
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g; s/_VERSION_TAG_/${{ env.release_version }}/g" k8s/deployment-prod.yaml > k8s/deployment-prod_mod.yaml | |
- name: Continuous deployment prod system at *.walt.id | |
uses: actions-hub/kubectl@master | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} | |
with: | |
args: apply -n default -f k8s/deployment-prod_mod.yaml | |
- name: Prepare dev CD | |
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g; s/_VERSION_TAG_/${{ env.release_version }}/g" k8s/deployment-dev.yaml > k8s/deployment-dev_mod.yaml | |
- name: Continuous deployment dev system at *.walt-test.cloud | |
uses: actions-hub/kubectl@master | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} | |
with: | |
args: apply -n dev -f k8s/deployment-dev_mod.yaml |