-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfcb612
commit e64133b
Showing
1 changed file
with
131 additions
and
131 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,137 +21,137 @@ jobs: | |
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: '0' | ||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
versionSpec: 5.x | ||
- id: determine_version | ||
name: Determine Version | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
additionalArguments: /overrideconfig mode=Mainline | ||
- name: Install Octopus Deploy CLI | ||
uses: OctopusDeploy/install-octopus-cli-action@v1 | ||
with: | ||
version: latest | ||
- name: Set up JDK 1.17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: adopt | ||
- name: Set Version | ||
run: ./mvnw --batch-mode versions:set -DnewVersion=${{ steps.determine_version.outputs.semVer }} | ||
shell: bash | ||
- name: List Dependencies | ||
run: ./mvnw --batch-mode dependency:tree --no-transfer-progress > dependencies.txt | ||
shell: bash | ||
- name: Collect Dependencies | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Dependencies | ||
path: dependencies.txt | ||
- name: List Dependency Updates | ||
run: ./mvnw --batch-mode versions:display-dependency-updates > dependencyUpdates.txt | ||
shell: bash | ||
- name: Collect Dependency Updates | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Dependencies Updates | ||
path: dependencyUpdates.txt | ||
- name: Test | ||
run: ./mvnw --batch-mode test | ||
shell: bash | ||
- if: always() | ||
name: Report | ||
uses: dorny/test-reporter@v1 | ||
with: | ||
name: Maven Tests | ||
path: target/surefire-reports/*.xml | ||
reporter: java-junit | ||
fail-on-error: 'false' | ||
- name: Package | ||
run: ./mvnw --batch-mode -DskipTests=true package | ||
shell: bash | ||
- id: get_artifact | ||
name: Get Artifact Path | ||
run: |- | ||
# Find the largest WAR or JAR, and assume that was what we intended to build. | ||
echo "::set-output name=artifact::$(find target -type f \( -iname \*.jar -o -iname \*.war \) -printf "%p\n" | sort -n | head -1)" | ||
shell: bash | ||
- id: get_artifact_name | ||
name: Get Artifact Name | ||
run: |- | ||
# Get the filename without a path | ||
path="${{ steps.get_artifact.outputs.artifact }}" | ||
echo "::set-output name=artifact::${path##*/}" | ||
shell: bash | ||
- name: Tag Release | ||
uses: mathieudutour/[email protected] | ||
with: | ||
custom_tag: ${{ steps.determine_version.outputs.semVer }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- id: create_release | ||
name: Create Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }} | ||
release_name: Release ${{ steps.determine_version.outputs.semVer }} Run ${{ github.run_number }} Attempt ${{ github.run_attempt }} | ||
draft: 'false' | ||
prerelease: 'false' | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ steps.get_artifact.outputs.artifact }} | ||
asset_name: ${{ steps.get_artifact_name.outputs.artifact }} | ||
asset_content_type: application/octet-stream | ||
- id: get_octopus_artifact | ||
name: Create Octopus Artifact | ||
run: |- | ||
# Octopus expects artifacts to have a specific file format | ||
file="${{ steps.get_artifact.outputs.artifact }}" | ||
extension="${file##*.}" | ||
octofile="SampleMavenProject-SpringBoot.${{ steps.determine_version.outputs.semVer }}.${extension}" | ||
cp ${file} ${octofile} | ||
echo "::set-output name=artifact::${octofile}" | ||
# The version used when creating a release is the package id, colon, and version | ||
octoversion="SampleMavenProject-SpringBoot:${{ steps.determine_version.outputs.semVer }}" | ||
echo "::set-output name=octoversion::${octoversion}" | ||
ls -la | ||
shell: bash | ||
- name: Push packages to Octopus Deploy | ||
uses: OctopusDeploy/push-package-action@v2 | ||
env: | ||
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }} | ||
OCTOPUS_CLI_SERVER: ${{ secrets.OCTOPUS_SERVER_URL }} | ||
with: | ||
packages: ${{ steps.get_octopus_artifact.outputs.artifact }} | ||
overwrite_mode: OverwriteExisting | ||
- name: Generate Octopus Deploy build information | ||
uses: OctopusDeploy/push-build-information-action@v3 | ||
env: | ||
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }} | ||
OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER_URL }} | ||
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SPACE }} | ||
with: | ||
version: ${{ steps.determine_version.outputs.semVer }} | ||
packages: SampleMavenProject-SpringBoot | ||
overwrite_mode: OverwriteExisting | ||
- name: Create Octopus Release | ||
uses: OctopusDeploy/create-release-action@v1 | ||
with: | ||
api_key: ${{ secrets.OCTOPUS_API_TOKEN }} | ||
project: SampleMavenProject-SpringBoot | ||
server: ${{ secrets.OCTOPUS_SERVER_URL }} | ||
deploy_to: Development | ||
packages: ${{ steps.get_octopus_artifact.outputs.octoversion }} | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: '0' | ||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
versionSpec: 5.x | ||
- id: determine_version | ||
name: Determine Version | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
additionalArguments: /overrideconfig mode=Mainline | ||
- name: Install Octopus Deploy CLI | ||
uses: OctopusDeploy/install-octopus-cli-action@v1 | ||
with: | ||
version: latest | ||
- name: Set up JDK 1.17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: adopt | ||
- name: Set Version | ||
run: ./mvnw --batch-mode versions:set -DnewVersion=${{ steps.determine_version.outputs.semVer }} | ||
shell: bash | ||
- name: List Dependencies | ||
run: ./mvnw --batch-mode dependency:tree --no-transfer-progress > dependencies.txt | ||
shell: bash | ||
- name: Collect Dependencies | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Dependencies | ||
path: dependencies.txt | ||
- name: List Dependency Updates | ||
run: ./mvnw --batch-mode versions:display-dependency-updates > dependencyUpdates.txt | ||
shell: bash | ||
- name: Collect Dependency Updates | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Dependencies Updates | ||
path: dependencyUpdates.txt | ||
- name: Test | ||
run: ./mvnw --batch-mode test | ||
shell: bash | ||
- if: always() | ||
name: Report | ||
uses: dorny/test-reporter@v1 | ||
with: | ||
name: Maven Tests | ||
path: target/surefire-reports/*.xml | ||
reporter: java-junit | ||
fail-on-error: 'false' | ||
- name: Package | ||
run: ./mvnw --batch-mode -DskipTests=true package | ||
shell: bash | ||
- id: get_artifact | ||
name: Get Artifact Path | ||
run: |- | ||
# Find the largest WAR or JAR, and assume that was what we intended to build. | ||
echo "::set-output name=artifact::$(find target -type f \( -iname \*.jar -o -iname \*.war \) -printf "%p\n" | sort -n | head -1)" | ||
shell: bash | ||
- id: get_artifact_name | ||
name: Get Artifact Name | ||
run: |- | ||
# Get the filename without a path | ||
path="${{ steps.get_artifact.outputs.artifact }}" | ||
echo "::set-output name=artifact::${path##*/}" | ||
shell: bash | ||
- name: Tag Release | ||
uses: mathieudutour/[email protected] | ||
with: | ||
custom_tag: ${{ steps.determine_version.outputs.semVer }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- id: create_release | ||
name: Create Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }} | ||
release_name: Release ${{ steps.determine_version.outputs.semVer }} Run ${{ github.run_number }} Attempt ${{ github.run_attempt }} | ||
draft: 'false' | ||
prerelease: 'false' | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ steps.get_artifact.outputs.artifact }} | ||
asset_name: ${{ steps.get_artifact_name.outputs.artifact }} | ||
asset_content_type: application/octet-stream | ||
- id: get_octopus_artifact | ||
name: Create Octopus Artifact | ||
run: |- | ||
# Octopus expects artifacts to have a specific file format | ||
file="${{ steps.get_artifact.outputs.artifact }}" | ||
extension="${file##*.}" | ||
octofile="SampleMavenProject-SpringBoot.${{ steps.determine_version.outputs.semVer }}.${extension}" | ||
cp ${file} ${octofile} | ||
echo "::set-output name=artifact::${octofile}" | ||
# The version used when creating a release is the package id, colon, and version | ||
octoversion="SampleMavenProject-SpringBoot:${{ steps.determine_version.outputs.semVer }}" | ||
echo "::set-output name=octoversion::${octoversion}" | ||
ls -la | ||
shell: bash | ||
- name: Push packages to Octopus Deploy | ||
uses: OctopusDeploy/push-package-action@v3 | ||
env: | ||
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }} | ||
OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER_URL }} | ||
with: | ||
packages: ${{ steps.get_octopus_artifact.outputs.artifact }} | ||
overwrite_mode: OverwriteExisting | ||
- name: Generate Octopus Deploy build information | ||
uses: OctopusDeploy/push-build-information-action@v3 | ||
env: | ||
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }} | ||
OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER_URL }} | ||
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SPACE }} | ||
with: | ||
version: ${{ steps.determine_version.outputs.semVer }} | ||
packages: SampleMavenProject-SpringBoot | ||
overwrite_mode: OverwriteExisting | ||
- name: Create Octopus Release | ||
uses: OctopusDeploy/create-release-action@v3 | ||
env: | ||
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }} | ||
OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER_URL }} | ||
with: | ||
project: SampleMavenProject-SpringBoot | ||
packages: ${{ steps.get_octopus_artifact.outputs.octoversion }} | ||
permissions: | ||
id-token: write | ||
checks: write | ||
|