|
1 | | -name: Publish package to GitHub Packages |
| 1 | +name: Release Package |
| 2 | + |
2 | 3 | on: |
3 | 4 | workflow_dispatch: |
4 | 5 | inputs: |
5 | 6 | version: |
6 | | - description: "Version name to publish (eg: x.x.x)" |
| 7 | + description: "Version (eg: x.x.x)" |
7 | 8 | type: string |
8 | 9 | required: true |
9 | 10 |
|
10 | 11 | jobs: |
11 | | - publish: |
12 | | - timeout-minutes: 15 |
| 12 | + build-and-publish: |
13 | 13 | runs-on: ubuntu-24.04 |
| 14 | + timeout-minutes: 15 |
14 | 15 | permissions: |
15 | 16 | contents: read |
16 | 17 | packages: write |
17 | | - |
18 | 18 | steps: |
19 | | - - uses: actions/checkout@v4 |
20 | | - |
21 | | - - uses: aboutbits/github-actions-java/setup-and-install@v3 |
22 | | - |
23 | | - - name: Set Version |
24 | | - run: sed -i 's|<version>BUILD-SNAPSHOT</version>|<version>${{ github.event.inputs.version }}</version>|g' pom.xml |
25 | | - |
| 19 | + - uses: actions/checkout@v5 |
| 20 | + with: |
| 21 | + token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
| 22 | + - uses: aboutbits/github-actions-base/git-setup@v2 |
| 23 | + - uses: aboutbits/github-actions-java/setup-with-maven@v4 |
| 24 | + with: |
| 25 | + java-version: 21 |
| 26 | + - uses: aboutbits/github-actions-java/set-version-with-maven@v4 |
| 27 | + with: |
| 28 | + version: "${{ github.event.inputs.version }}" |
26 | 29 | - name: Publish package |
27 | | - run: mvn --batch-mode deploy |
28 | 30 | env: |
29 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
30 | | - |
31 | | - release: |
32 | | - timeout-minutes: 5 |
33 | | - runs-on: ubuntu-24.04 |
34 | | - needs: publish |
35 | | - steps: |
36 | | - - uses: actions/checkout@v4 |
37 | | - |
38 | | - - name: Create GitHub release |
39 | | - uses: actions/github-script@v7 |
| 31 | + GITHUB_USER_NAME: ${{ github.actor }} |
| 32 | + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml --batch-mode deploy |
| 34 | + shell: bash |
| 35 | + - uses: aboutbits/github-actions-base/git-commit-and-push-all@v2 |
| 36 | + with: |
| 37 | + message: '${{ github.event.inputs.version }}' |
| 38 | + - uses: aboutbits/github-actions-base/git-create-or-update-tag@v2 |
| 39 | + with: |
| 40 | + tag-name: 'v${{ github.event.inputs.version }}' |
| 41 | + - uses: aboutbits/github-actions-base/github-create-release@v2 |
40 | 42 | with: |
41 | | - script: | |
42 | | - github.rest.repos.createRelease({ |
43 | | - owner: context.repo.owner, |
44 | | - repo: context.repo.repo, |
45 | | - tag_name: '${{ github.event.inputs.version }}', |
46 | | - name: 'Release ${{ github.event.inputs.version }}', |
47 | | - prerelease: '${{ github.event.inputs.version }}'.includes('RC') |
48 | | - }) |
| 43 | + tag-name: 'v${{ github.event.inputs.version }}' |
0 commit comments