Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.

Commit b267001

Browse files
authored
forenkler build.yml litt (#34)
1 parent 6dd1da1 commit b267001

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ on:
66
tags-ignore:
77
- "**" # Don't build any tags
88

9-
# FIXME: Legg til docker layer caching, f.eks. https://github.com/marketplace/actions/build-docker-images-using-cache
109
jobs:
1110
build:
1211
name: Build and push docker image
1312
runs-on: ubuntu-latest
13+
env:
14+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}
1415
steps:
15-
- uses: actions/checkout@v1
16+
- uses: actions/checkout@v2
1617
- name: Login to GitHub Docker Registry
1718
uses: docker/login-action@v1
1819
with:
@@ -24,15 +25,11 @@ jobs:
2425
uses: navikt/sosialhjelp-ci/actions/create-artifact-version@master
2526
- name: Create docker image tags
2627
run: |
27-
PROJECT_NAME=$(echo $GITHUB_REPOSITORY | cut -d/ -f2)
28-
echo "ghcr.io/$GITHUB_REPOSITORY/$PROJECT_NAME:$VERSION" > DOCKER_TAG
29-
env:
30-
VERSION: ${{ steps.artifact-version.outputs.version }}
28+
echo "DOCKER_TAG=${{ env.DOCKER_IMAGE }}:${{ steps.artifact-version.outputs.version }}" >> $GITHUB_ENV
3129
- name: Build docker image
32-
run: docker build -t $(cat DOCKER_TAG) .
30+
run: docker build -t ${{ env.DOCKER_TAG }} .
3331
- name: Create tag and release
34-
# TODO: Bytt ut med upstream når/hvis https://github.com/actions/create-release/pull/32 merges
35-
uses: fleskesvor/create-release@feature/support-target-commitish
32+
uses: actions/create-release@v1
3633
env:
3734
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3835
with:
@@ -41,4 +38,4 @@ jobs:
4138
commitish: ${{ github.sha }}
4239
- name: Push docker image
4340
run: |
44-
docker push $(cat DOCKER_TAG)
41+
docker push ${{ env.DOCKER_TAG }}

0 commit comments

Comments
 (0)