fjerner mottattDato da det er overflødig/redundant #50
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release common | |
on: | |
workflow_dispatch: # Allow manually triggered workflow run | |
push: | |
paths: | |
- common/** | |
- gradle/libs.versions.toml | |
jobs: | |
build: | |
name: Verification | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
cache: gradle | |
# Build | |
- name: Test and build | |
run: ./gradlew :common:build --configuration-cache | |
release-dev: | |
name: Create Release - Dev | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
if: github.ref != 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
cache: gradle | |
- name: Create Release | |
id: create_release | |
uses: elgohr/Github-Release-Action@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
title: common.dev | |
prerelease: true | |
- name: Upload artifact | |
run: ./gradlew :common:publish -Pversion="dev.$(echo $GITHUB_SHA | cut -c 1-12).dev" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
name: Create Release | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
cache: gradle | |
- name: Set release tag | |
run: | | |
export TAG_NAME="$(TZ="Europe/Oslo" date +%Y.%m.%d-%H.%M).$(echo $GITHUB_SHA | cut -c 1-12)" | |
echo "RELEASE_TAG=$TAG_NAME" >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: elgohr/Github-Release-Action@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
title: common.${{ env.RELEASE_TAG }} | |
- name: Upload artifact | |
run: ./gradlew :common:publish -Pversion="${{ env.RELEASE_TAG }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |