Skip to content

Commit b064444

Browse files
committed
Build and push a zip file
1 parent 108b47f commit b064444

File tree

2 files changed

+62
-7
lines changed

2 files changed

+62
-7
lines changed

.github/workflows/build.yaml

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,48 @@ jobs:
1818
uses: actions/setup-dotnet@v4
1919
with:
2020
dotnet-version: '8.0.x'
21+
22+
- name: Install CycloneDX
23+
run: dotnet tool install --global CycloneDX
24+
shell: bash
25+
26+
- name: Generate SBOM
27+
run: dotnet-CycloneDX WindowsServiceDotNETCore.csproj --output . --output-format json
28+
shell: bash
29+
30+
- name: Set Version
31+
if: ${{ steps.branch-name.outputs.current_branch == 'main' }}
32+
run: echo "PACKAGE_VERSION=$(date +'%Y%m%d').${{ github.run_number }}.${{ github.run_attempt }}" >> $GITHUB_ENV
33+
shell: bash
34+
35+
- name: Configure maven-repository-aws-s3
36+
run: |
37+
cat <<EOT > ~/.m2/settings.xml
38+
<settings>
39+
<servers>
40+
<server>
41+
<id>octopus-sales-public-snapshot</id>
42+
<username>${{ inputs.aws_access_key }}</username>
43+
<password>${{ inputs.aws_secret_access_key }}</password>
44+
<configuration>
45+
<region>ap-southeast-2</region>
46+
<publicRepository>true</publicRepository>
47+
</configuration>
48+
</server>
49+
<server>
50+
<id>octopus-sales-public-release</id>
51+
<username>${{ inputs.aws_access_key }}</username>
52+
<password>${{ inputs.aws_secret_access_key }}</password>
53+
<configuration>
54+
<region>ap-southeast-2</region>
55+
<publicRepository>true</publicRepository>
56+
</configuration>
57+
</server>
58+
</servers>
59+
</settings>
60+
EOT
61+
shell: bash
62+
working-directory: java
2163

2264
- name: Restore dependencies
2365
run: dotnet restore
@@ -27,9 +69,20 @@ jobs:
2769

2870
- name: Publish
2971
run: dotnet publish --configuration Release --output ./publish
30-
31-
- name: Upload artifact
32-
uses: actions/upload-artifact@v4
33-
with:
34-
name: published-app
35-
path: ./publish
72+
73+
- name: Build and push static web package
74+
run: |
75+
pushd publish
76+
zip -r ../windowsservice.${{ env.PACKAGE_VERSION }}.zip .
77+
popd
78+
79+
mvn deploy:deploy-file \
80+
--batch-mode \
81+
"-DgroupId=com.octopus" \
82+
"-DartifactId=windowsservice" \
83+
"-Dversion=${{ env.PACKAGE_VERSION }}" \
84+
"-Dpackaging=zip" \
85+
"-Dfile=windowsservice.${{ env.PACKAGE_VERSION }}.zip" \
86+
"-DrepositoryId=octopus-sales-public-snapshot" \
87+
"-Durl=s3://octopus-sales-public-maven-repo/snapshot"
88+
shell: bash

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
bin/**
2-
obj/**
2+
obj/**
3+
bom.json
4+
*.zip

0 commit comments

Comments
 (0)