|
1 |
| -name: Build and Deploy |
| 1 | +name: Bygg og publiser pakke på GitHub Packages |
| 2 | + |
2 | 3 | on:
|
3 | 4 | push:
|
4 | 5 | branches:
|
5 | 6 | - 'main'
|
6 | 7 |
|
7 | 8 | jobs:
|
8 |
| - build: |
9 |
| - name: Build and test |
10 |
| - runs-on: ubuntu-latest |
11 |
| - steps: |
12 |
| - - uses: actions/checkout@v4 |
13 |
| - |
14 |
| - - uses: actions/setup-java@v4 |
15 |
| - with: |
16 |
| - java-version: '21' |
17 |
| - distribution: 'temurin' |
18 |
| - cache: 'gradle' |
19 |
| - |
20 |
| - - uses: gradle/actions/setup-gradle@v3 |
21 |
| - with: |
22 |
| - arguments: build |
23 |
| - |
24 |
| - - name: Post build failures to Slack |
25 |
| - if: failure() |
26 |
| - run: | |
27 |
| - curl -X POST --data "{\"text\": \"Build av $GITHUB_REPOSITORY feilet - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}" $WEBHOOK_URL |
28 |
| - env: |
29 |
| - WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
30 |
| - |
31 |
| - release: |
32 |
| - name: Create Release |
33 |
| - needs: build |
34 |
| - runs-on: ubuntu-latest |
| 9 | + build_and_deploy: |
| 10 | + name: "Opprett og publiser leveranse på GitHub Packages" |
| 11 | + uses: navikt/tilleggsstonader/.github/workflows/java-build-and-publish-release.yml@main |
| 12 | + secrets: inherit |
35 | 13 | permissions:
|
36 | 14 | contents: write
|
37 | 15 | packages: write
|
38 |
| - steps: |
39 |
| - - name: Checkout code |
40 |
| - uses: actions/checkout@v4 |
41 |
| - |
42 |
| - - name: Set release tag |
43 |
| - run: | |
44 |
| - export TAG_NAME="$(TZ="Europe/Oslo" date +%Y.%m.%d-%H.%M).$(git rev-parse --short=12 HEAD)" |
45 |
| - echo "RELEASE_TAG=$TAG_NAME" >> $GITHUB_ENV |
46 |
| - #- name: Set changelog |
47 |
| - # id: changelog |
48 |
| - # # (Escape newlines see https://github.com/actions/create-release/issues/25) |
49 |
| - # run: | |
50 |
| - # text="$(git --no-pager log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" |
51 |
| - # echo "::set-output name=CHANGELOG::$text" |
52 |
| - |
53 |
| - - name: Create release |
54 |
| - uses: softprops/action-gh-release@v2 |
55 |
| - with: |
56 |
| - name: Release ${{ env.RELEASE_TAG }} |
57 |
| - tag_name: ${{ env.RELEASE_TAG }} |
58 |
| - draft: false |
59 |
| - prerelease: false |
60 |
| - |
61 |
| - - name: Publish |
62 |
| - uses: gradle/actions/setup-gradle@v3 |
63 |
| - env: |
64 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
65 |
| - with: |
66 |
| - arguments: -Pversion=${{ env.RELEASE_TAG }} publish |
67 |
| - |
68 |
| - - name: Post release failures to Slack |
69 |
| - if: failure() |
70 |
| - run: | |
71 |
| - curl -X POST --data "{\"text\": \"Release av $GITHUB_REPOSITORY feilet - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}" $WEBHOOK_URL |
72 |
| - env: |
73 |
| - WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
0 commit comments