File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 env:
2424 GITHUB_USER_NAME: ${{ github.actor }}
2525 GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+ snapshot :
28+ name : Publish snapshot
29+ runs-on : ubuntu-22.04
30+ timeout-minutes : 10
31+ needs : test
32+ if : github.event_name == 'pull_request'
33+ steps :
34+ - name : Set Version
35+ run : sed -i 's|<version>BUILD-SNAPSHOT</version>|<version>${{ github.event.pull_request.number }}-SNAPSHOT</version>|g' pom.xml
36+ - run : >-
37+ ./mvnw
38+ -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml
39+ --batch-mode
40+ -DskipTests=true
41+ deploy
42+ env:
43+ GITHUB_USER_NAME: ${{ github.actor }}
44+ GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+ remove-snapshot :
47+ name : Remove Snapshot
48+ runs-on : ubuntu-22.04
49+ timeout-minutes : 10
50+ if : github.event_name == 'pull_request' && github.event.action == 'closed'
51+ steps :
52+ - name : Authenticate with GitHub Packages
53+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_USER_NAME --password-stdin
54+ - name : Remove snapshot version from repository
55+ run : |
56+ curl -X DELETE -u ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} \
57+ https://maven.pkg.github.com/OWNER/REPOSITORY/com/example/myartifact/${{ github.event.pull_request.number }}-SNAPSHOT/
You can’t perform that action at this time.
0 commit comments