Skip to content

Commit 1325e9a

Browse files
authoredSep 30, 2024··
Merge pull request #74 from navikt/felles-github-actions
Felles GitHub actions
2 parents 23b4bc4 + 429ce08 commit 1325e9a

File tree

3 files changed

+28
-80
lines changed

3 files changed

+28
-80
lines changed
 

‎.github/workflows/build-deploy.yml

+6-64
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,15 @@
1-
name: Build and Deploy
1+
name: Bygg og publiser pakke på GitHub Packages
2+
23
on:
34
push:
45
branches:
56
- 'main'
67

78
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
3513
permissions:
3614
contents: write
3715
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 }}

‎.github/workflows/pr.yml

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
name: Pull Request
1+
name: Bygg app og kjør tester
2+
23
on:
3-
pull_request:
44
workflow_dispatch:
5+
pull_request:
56

67
jobs:
78
build:
8-
name: Build and test
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v4
12-
13-
- uses: actions/setup-java@v4
14-
with:
15-
java-version: '21'
16-
distribution: 'temurin'
17-
cache: 'gradle'
18-
19-
- uses: gradle/actions/setup-gradle@v3
20-
with:
21-
arguments: build
9+
name: "Bygger prosjektet, sjekker linting og kjører testene"
10+
uses: navikt/tilleggsstonader/.github/workflows/java-build-and-test.yml@main
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Send inn avhengighetsgraf til GitHub Security
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- "**.gradle.kts"
10+
- "gradle.properties"
11+
12+
jobs:
13+
submit-dependency-graph:
14+
name: "Genererer opp avhengighetsgraf og sender den til GHAS"
15+
uses: navikt/tilleggsstonader/.github/workflows/submit-dependency-graph.yml@main
16+
permissions:
17+
contents: "write" # Kreves av Dependency Submission API-et

0 commit comments

Comments
 (0)
Please sign in to comment.