Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/build-and-stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build and deploy JAR

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
checks: write
contents: read
pull-requests: write
statuses: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Java version
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: liberica

- name: Build with Gradle
run: ./gradlew --no-daemon build

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: java-app
path: 'build/libs/*.jar'

deploy:
name: Deploy
if: ${{ github.secret_source == 'Actions' }}
environment:
name: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || vars.STAGING_SLOT_NAME }}
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
env:
SLOT_NAME: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || vars.STAGING_SLOT_NAME }}
needs: build
runs-on: ubuntu-latest

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: java-app

- name: Login to Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: If PR, create a new staging slot
if: ${{ github.event_name == 'pull_request' }}
run: az webapp deployment slot create --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --name ${{ vars.AZURE_WEBAPP_NAME}} --slot ${{ env.SLOT_NAME }} --configuration-source ${{ vars.STAGING_SLOT_NAME }}

- name: Deploy to staging slot
id: deploy-to-webapp
if: ${{ github.secret_source == 'Actions' }}
uses: azure/webapps-deploy@v3
with:
app-name: 'initializr-config'
package: '*.jar'
slot-name: ${{ env.SLOT_NAME }}

- name: If PR, comment with the preview link
if: ${{ github.event_name == 'pull_request' }}
uses: mshick/add-pr-comment@v2
with:
message: |
## Preview link: https://${{ vars.AZURE_WEBAPP_NAME }}-${{ env.SLOT_NAME }}.azurewebsites.net/SteeltoeInitializr/Staging

- Your changes have been deployed to the preview site. The preview site will update as you add more commits to this branch.
- The preview link is shareable, but will be deleted when the pull request is merged or closed.

> *This is an automated message.*
repo-token: ${{ secrets.GITHUB_TOKEN }}
55 changes: 0 additions & 55 deletions .github/workflows/build-deploy.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/pr-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Delete a preview environment

on:
pull_request:
types:
- closed

env:
SLOT_NAME: pr-${{ github.event.number }}

jobs:
delete-slot:
runs-on: ubuntu-latest

steps:
- name: Log into Azure CLI with service principal
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Delete slot on staging site
run: az webapp deployment slot delete --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --name ${{ vars.AZURE_WEBAPP_NAME}} --slot ${{ env.SLOT_NAME }}

delete-deployment:
runs-on: ubuntu-latest

steps:
- name: Delete Deployment Environment
uses: strumwolf/delete-deployment-environment@v3
with:
environment: "pr-${{ github.event.number }}"
token: ${{ secrets.GITHUB_TOKEN }}
onlyRemoveDeployments: true
22 changes: 22 additions & 0 deletions .github/workflows/stage-prod-swap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Swap staging slot contents into production

on:
workflow_dispatch:

jobs:
promote-to-production:
name: Promote to production
runs-on: ubuntu-latest
environment:
name: production
url: 'https://${{ vars.AZURE_WEBAPP_NAME }}.azurewebsites.net/'

steps:
- name: Log into Azure CLI with service principal
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Swap slots
run: az webapp deployment slot swap -s ${{ vars.STAGING_SLOT_NAME }} -n ${{ vars.AZURE_WEBAPP_NAME }} -g ${{ vars.AZURE_RESOURCE_GROUP }}

73 changes: 0 additions & 73 deletions azure-pipelines.yaml

This file was deleted.

20 changes: 12 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
plugins {
id 'org.springframework.boot' version '3.2.2'
id 'io.spring.dependency-management' version '1.1.4'
id 'java'
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
id 'java'
id 'org.springframework.boot' version '3.5.4'
id 'io.spring.dependency-management' version '1.1.7'
id 'com.gorylenko.gradle-git-properties' version '2.4.2'
}

group = steeltoeInitializrConfigServerGroup
version = steeltoeInitializrConfigServerVersion

java {
sourceCompatibility = '17'
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}


repositories {
mavenCentral()
}

ext {
set('springCloudVersion', "2023.0.0")
set('springCloudVersion', "2025.0.0")
}

dependencies {
implementation 'org.springframework.cloud:spring-cloud-config-server'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.cloud:spring-cloud-config-server'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

dependencyManagement {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading