microsoft/gctoolkit

Public

mirrored fromhttps://github.com/microsoft/gctoolkitAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
6248d3dfc2aa07d0ecb68f554dd28dabaf00aaca

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/release_to_github.yml

63lines · modecode

1name: Release to GitHub
2
3on:
4 workflow_dispatch:
5
6jobs:
7 release:
8 permissions:
9 contents: write
10
11 runs-on: ubuntu-latest
12
13 steps:
14 - name: Checkout project
15 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16 with:
17 ref: main
18 fetch-depth: 0
19
20 - name: Cache Maven
21 uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
22 with:
23 path: ~/.m2/repository
24 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
25 restore-keys: ${{ runner.os }}-m2
26
27 - name: Setup Java JDK
28 uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
29 with:
30 java-version: '11'
31 distribution: 'microsoft'
32
33 - name: Version
34 id: version
35 run: |
36 release_version=$( ./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout )
37 release_version=${release_version%-*}
38 echo "tag=gctoolkit-${release_version}" >> "$GITHUB_ENV"
39
40 # Get the previous release version from what is actually on GitHub
41 previous_tag=$( curl --location --silent \
42 -H "Accept: application/vnd.github+json" \
43 https://api.github.com/repos/microsoft/gctoolkit/releases/latest | grep 'tag_name' )
44 previous_tag=$( perl -pe 's/"tag_name":\s+"(.*?)",?/$1/' <<< "${previous_tag}" )
45 echo "previous_tag=${previous_tag}" >> "$GITHUB_ENV"
46
47 - name: Release Prepare
48 run: |
49 ./mvnw -B -Prelease release:clean release:prepare \
50 -Drepository.url=https://${{ github.actor }}:${{ secrets.RELEASE_TOKEN }}@github.com/${{ github.repository }}.git
51 env:
52 GIT_AUTHOR_NAME: 'Git'
53 GIT_AUTHOR_EMAIL: 'noreply@github.com'
54 GIT_COMMITTER_NAME: 'Git'
55 GIT_COMMITTER_EMAIL: 'noreply@github.com'
56
57 - name: Release to GitHub
58 run: |
59 ./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release \
60 -Djreleaser.previous.tag.name="$previous_tag" \
61 -Djreleaser.tag.name="$tag"
62 env:
63 JRELEASER_GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}