Skip to content

Commit

Permalink
Merge pull request #56 from statisticsnorway/release
Browse files Browse the repository at this point in the history
Release 1.3.14
  • Loading branch information
mallport authored Oct 8, 2024
2 parents 4f6dafd + fba65c5 commit 807f63b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/mvn-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
contents: write
id-token: write
packages: write
pull-requests: write

steps:
- uses: actions/checkout@v4
Expand All @@ -38,21 +39,35 @@ jobs:
service_account: "gh-actions-dapla-stat@artifact-registry-5n.iam.gserviceaccount.com"
token_format: access_token

- name: Maven release and deploy to GitHub packages
- name: Setup Maven authentication to GitHub packages
uses: s4u/[email protected]
id: maven_settings
with:
servers: '[{"id": "github","configuration": {"httpHeaders": {"property": {"name": "Authorization","value": "Bearer ${{ secrets.GITHUB_TOKEN }}"}}}}]'

- name: Maven release and deploy to GitHub packages and Artifact Registry
id: release_artifact
env:
MAVEN_USERNAME: ${env.GITHUB_ACTOR}
MAVEN_PASSWORD: ${env.GITHUB_TOKEN}
run: |
git config user.name github-actions
git config user.email [email protected]
# Get the release version from the pom.xml before the next snapshot increment
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed "s/-SNAPSHOT//")
echo "version=${VERSION}" >> $GITHUB_OUTPUT
# Perform the release/deploy and increment the version to the next snapshot
mvn --batch-mode release:prepare -P github -Darguments="-Dmaven.test.skip=true -Dmaven.deploy.skip=true"
mvn --batch-mode release:prepare -P github,artifact-registry -Darguments="-Dmaven.test.skip=true -Dmaven.deploy.skip=true"
mvn --batch-mode release:perform
TAG=$(git describe --abbrev=0 --tags)
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Create GitHub release draft
uses: release-drafter/release-drafter@v6
id: create_github_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.release_artifact.outputs.tag }}

Expand All @@ -65,9 +80,13 @@ jobs:
echo "Uploading $file"
gh release upload ${{ steps.create_github_release.outputs.tag_name }} $file
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create a pull request with the changes in the branch
run: |
pr_title="Release ${{steps.release_artifact.outputs.tag}}"
pr_body="This PR is autogenerated by a workflow. A release draft has been created and should be published after merging."
gh pr create --title $pr_title --body $pr_body
gh pr create --title "$pr_title" --body "$pr_body" --head $(git branch --show-current)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>no.ssb.maskinporten</groupId>
<artifactId>maskinporten-guardian</artifactId>
<version>1.3.3-SNAPSHOT</version>
<version>1.3.15-SNAPSHOT</version>
<packaging>${packaging}</packaging>

<parent>
Expand Down

0 comments on commit 807f63b

Please sign in to comment.