Konverter til monorepo for beregning med forskudd beregning api #2
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 Drafter | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, reopened, synchronize] | |
permissions: | |
contents: write | |
env: | |
publish: ${{github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/dependabot')}} | |
jobs: | |
build-artifact: | |
name: "Build and run tests" | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo ${{ github.ref }} | |
echo ${{ github.base_ref }} | |
echo ${{ github.head_ref }} | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Resolve/Update Dependencies | |
run: mvn package dependency:resolve-plugins dependency:go-offline | |
- name: Build (and run tests) | |
run: mvn clean install | |
- name: Save test results | |
run: | | |
mkdir -p ~/test-results/junit/ | |
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \; | |
update_release_draft_labels: | |
if: github.ref != 'refs/heads/main' | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: release-drafter/release-drafter@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
update_release_draft: | |
needs: build-artifact | |
if: github.ref == 'refs/heads/main' | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setting version | |
id: set_version | |
run: | | |
export GIT_COMMIT_DATE=$(git log -1 --pretty='%ad' --date=format:'%Y.%m.%d.%H%M%S') | |
export VERSION=${GIT_COMMIT_DATE} | |
echo "VERSION=${GIT_COMMIT_DATE}" >> $GITHUB_ENV | |
echo "Setting version $VERSION" | |
- uses: release-drafter/release-drafter@v5 | |
with: | |
version: ${{ env.VERSION }} | |
tag: ${{ env.VERSION }} | |
name: "Release ${{ env.VERSION }}" | |
publish: ${{ env.publish }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
version: ${{ env.VERSION }} | |
published: ${{ env.publish == true }} | |
publish: | |
needs: update_release_draft | |
if: ${{ needs.update_release_draft.outputs.published }} | |
permissions: | |
contents: "write" | |
id-token: "write" | |
packages: "write" | |
name: Publish package | |
uses: ./.github/workflows/publish_dispatcher.yaml | |
with: | |
version: ${{ needs.update_release_draft.outputs.version }} | |
secrets: inherit |