Skip to content

Create directory if not exists #5

Create directory if not exists

Create directory if not exists #5

Workflow file for this run

name: Build and Publish .NET Core App
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install CycloneDX
run: dotnet tool install --global CycloneDX
shell: bash
- name: Generate SBOM
run: dotnet-CycloneDX WindowsServiceDotNETCore.csproj --output . --output-format json
shell: bash
- name: Set Version
if: ${{ steps.branch-name.outputs.current_branch == 'main' }}
run: echo "PACKAGE_VERSION=$(date +'%Y%m%d').${{ github.run_number }}.${{ github.run_attempt }}" >> $GITHUB_ENV
shell: bash
- name: Configure maven-repository-aws-s3
run: |
mkdir -p ~/.m2
cat <<EOT > ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>octopus-sales-public-snapshot</id>
<username>${{ inputs.aws_access_key }}</username>
<password>${{ inputs.aws_secret_access_key }}</password>
<configuration>
<region>ap-southeast-2</region>
<publicRepository>true</publicRepository>
</configuration>
</server>
<server>
<id>octopus-sales-public-release</id>
<username>${{ inputs.aws_access_key }}</username>
<password>${{ inputs.aws_secret_access_key }}</password>
<configuration>
<region>ap-southeast-2</region>
<publicRepository>true</publicRepository>
</configuration>
</server>
</servers>
</settings>
EOT
shell: bash
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Publish
run: dotnet publish --configuration Release --output ./publish
- name: Build and push static web package
run: |
pushd publish
zip -r ../windowsservice.${{ env.PACKAGE_VERSION }}.zip .
popd
mvn deploy:deploy-file \
--batch-mode \
"-DgroupId=com.octopus" \
"-DartifactId=windowsservice" \
"-Dversion=${{ env.PACKAGE_VERSION }}" \
"-Dpackaging=zip" \
"-Dfile=windowsservice.${{ env.PACKAGE_VERSION }}.zip" \
"-DrepositoryId=octopus-sales-public-snapshot" \
"-Durl=s3://octopus-sales-public-maven-repo/snapshot"
shell: bash