diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1642fdc..e1ff335 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,9 @@ -name: Build on every push +name: Build on every push except main branch on: push: - branches: - - '*' - - '*/*' - - '**' - - '!main' - + branches-ignore: + - main jobs: build: @@ -15,15 +11,6 @@ jobs: 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@v2.1.0 with: @@ -42,8 +29,5 @@ jobs: uses: gradle/wrapper-validation-action@v1 - name: Running gradle build uses: eskatos/gradle-command-action@v1.3.3 - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} with: - arguments: build publish --no-daemon \ No newline at end of file + arguments: build \ No newline at end of file diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 8fcdb8d..4959e67 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,4 +1,4 @@ -name: Release on push to main +name: Pre-release on push to main on: push: @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index def78c4..805b7f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml new file mode 100644 index 0000000..70efffa --- /dev/null +++ b/.github/workflows/test-deploy.yml @@ -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/setup-java@v2.1.0 + 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/gradle-command-action@v1.3.3 + 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/build-push-action@v4.0.0 + # 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