Skip to content

sammenstiller versjoner #46

sammenstiller versjoner

sammenstiller versjoner #46

Workflow file for this run

name: build and publish
on:
push:
branches:
- main
jobs:
build:
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21.x'
cache: 'gradle'
- name: test and build
run: ./gradlew -Pversion="1.$(echo $GITHUB_SHA | cut -c1-7)" build publish
env:
ORG_GRADLE_PROJECT_githubUser: x-access-token
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
release:
name: Create Release
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'ci skip')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set release tag
run: echo "RELEASE_TAG=1.$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Set changelog
# (Escape newlines see https://github.com/actions/create-release/issues/25)
run: |
text="$(git --no-pager log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")"
text="${text//$'%'/%25}"
text="${text//$'\n'/%0A}"
text="${text//$'\r'/%0D}"
echo "CHANGELOG=$text" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_TAG }}
release_name: ${{ env.RELEASE_TAG }}
body: |
Changes in this Release
${{ env.CHANGELOG }}
draft: false
prerelease: false