Skip to content

Commit 80621d5

Browse files
committed
Add publish-snapshot workflow for GitHub Packages snapshot publishing
1 parent d8ec771 commit 80621d5

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish Snapshot to GitHub Packages
2+
3+
env:
4+
HUSKY: 0
5+
6+
on:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
packages: write
12+
13+
concurrency:
14+
group: publish-snapshot
15+
cancel-in-progress: false
16+
17+
jobs:
18+
publish-snapshot:
19+
name: Publish SNAPSHOT to GitHub Packages
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v6
23+
with:
24+
fetch-depth: 0
25+
26+
- uses: ./.github/actions/setup-copilot
27+
28+
- name: Set up JDK 17
29+
uses: actions/setup-java@v5
30+
with:
31+
java-version: "17"
32+
distribution: "temurin"
33+
cache: "maven"
34+
server-id: github
35+
server-username: PACKAGES_USERNAME
36+
server-password: PACKAGES_TOKEN
37+
38+
- name: Verify version is a SNAPSHOT
39+
run: |
40+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
41+
echo "Publishing version: $VERSION"
42+
if [[ "$VERSION" != *"-SNAPSHOT" ]]; then
43+
echo "ERROR: This workflow only publishes SNAPSHOT versions. Current version: $VERSION"
44+
exit 1
45+
fi
46+
echo "### Snapshot Publish" >> $GITHUB_STEP_SUMMARY
47+
echo "- **Version:** $VERSION" >> $GITHUB_STEP_SUMMARY
48+
echo "- **Repository:** GitHub Packages (github/copilot-sdk-java)" >> $GITHUB_STEP_SUMMARY
49+
50+
- name: Deploy Snapshot
51+
run: mvn -B deploy -DskipTests
52+
env:
53+
PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
PACKAGES_USERNAME: ${{ github.actor }}

0 commit comments

Comments
 (0)