Skip to content

Commit

Permalink
implementing new github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dinkar-jain committed Jan 10, 2024
1 parent 7a75faa commit 944c676
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 23 deletions.
24 changes: 4 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
name: Build on every push
name: Build on every push except main branch

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

branches-ignore:
- 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/[email protected]
with:
Expand All @@ -42,8 +29,5 @@ jobs:
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
arguments: build
6 changes: 3 additions & 3 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release on push to main
name: Pre-release on push to main

on:
push:
Expand All @@ -7,13 +7,13 @@ on:

jobs:
release:
name: "Release"
name: "Pre-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-alpha" >> $GITHUB_ENV
echo "release_version=1.0.$(date +'%g%m%d%H%M')-SNAPSHOT" >> $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
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ jobs:
with:
push: true
tags: waltid/xyzkit:latest, waltid/xyzkit:${{ inputs.release_version }}
- name: Prepare CD
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" k8s/deployment-prod.yaml > k8s/deployment_mod.yaml
# - name: Continuous deployment
# uses: actions-hub/kubectl@master
# env:
# KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
# with:
# args: apply -n portals -f k8s/deployment_mod.yaml
- name: Changelog
uses: ardalanamini/auto-changelog@v3
id: changelog
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy manually to test environment

on:
workflow_dispatch:

jobs:
build:
name: "Deploy to test environment"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- 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]
with:
arguments: build
- 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/xyzkit:latest, waltid/xyzkit:${{ github.ref }}
- name: Prepare CD
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" k8s/deployment-dev.yaml > k8s/deployment_mod.yaml
# - name: Continuous deployment
# uses: actions-hub/kubectl@master
# env:
# KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
# with:
# args: apply -n portals -f k8s/deployment_mod.yaml

0 comments on commit 944c676

Please sign in to comment.