microsoft/gctoolkit

Public

mirrored from https://github.com/microsoft/gctoolkitAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
caf01a11f38845186bfcf78ed9f8526a580ad762

Branches

Tags

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

Clone

HTTPS

Download ZIP

.github/workflows/release_to_github.yml

61lines · modecode

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