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

Commit 17e713b

Browse files
authored
ghcr.io + yaml formatting (#26)
1 parent 808ce0b commit 17e713b

File tree

2 files changed

+40
-39
lines changed

2 files changed

+40
-39
lines changed

.github/workflows/build.yml

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
11
name: Build
22
on:
3-
push:
4-
branches:
5-
- "**" # Build all branches
6-
tags-ignore:
7-
- "**" # Don't build any tags
3+
push:
4+
branches:
5+
- "**" # Build all branches
6+
tags-ignore:
7+
- "**" # Don't build any tags
88

99
# FIXME: Legg til docker layer caching, f.eks. https://github.com/marketplace/actions/build-docker-images-using-cache
1010
jobs:
11-
build:
12-
name: Build and push docker image
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v1
16-
- name: Login to GitHub package registry
17-
run: |
18-
echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_REPOSITORY} --password-stdin docker.pkg.github.com
19-
env:
20-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
- name: Create artifact version
22-
id: artifact-version
23-
uses: navikt/sosialhjelp-ci/actions/create-artifact-version@master
24-
- name: Create docker image tags
25-
run: |
26-
PROJECT_NAME=$(echo $GITHUB_REPOSITORY | cut -d/ -f2)
27-
echo "docker.pkg.github.com/$GITHUB_REPOSITORY/$PROJECT_NAME:$VERSION" > DOCKER_TAG
28-
env:
29-
VERSION: ${{ steps.artifact-version.outputs.version }}
30-
- name: Build docker image
31-
run: docker build -t $(cat DOCKER_TAG) .
32-
- name: Create tag and release
33-
# TODO: Bytt ut med upstream når/hvis https://github.com/actions/create-release/pull/32 merges
34-
uses: fleskesvor/create-release@feature/support-target-commitish
35-
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
with:
38-
tag_name: ${{ steps.artifact-version.outputs.version }}
39-
release_name: ${{ steps.artifact-version.outputs.version }}
40-
commitish: ${{ github.sha }}
41-
- name: Push docker image
42-
run: |
43-
docker push $(cat DOCKER_TAG)
11+
build:
12+
name: Build and push docker image
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Login to GitHub Docker Registry
17+
uses: docker/login-action@v1
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
- name: Create artifact version
23+
id: artifact-version
24+
uses: navikt/sosialhjelp-ci/actions/create-artifact-version@master
25+
- name: Create docker image tags
26+
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 }}
31+
- name: Build docker image
32+
run: docker build -t $(cat DOCKER_TAG) .
33+
- 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
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
with:
39+
tag_name: ${{ steps.artifact-version.outputs.version }}
40+
release_name: ${{ steps.artifact-version.outputs.version }}
41+
commitish: ${{ github.sha }}
42+
- name: Push docker image
43+
run: |
44+
docker push $(cat DOCKER_TAG)

.github/workflows/deploy_gcp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Sett env variabler
3333
run: |
3434
PROJECT_NAME=$(echo ${{ github.repository }} | cut -d/ -f2)
35-
echo "IMAGE=docker.pkg.github.com/${{ github.repository }}/$PROJECT_NAME:${{ steps.artifact-version.outputs.version }}" >> $GITHUB_ENV
35+
echo "IMAGE=ghcr.io/${{ github.repository }}/$PROJECT_NAME:${{ steps.artifact-version.outputs.version }}" >> $GITHUB_ENV
3636
echo "CLUSTER_NAME=${{ github.event.inputs.cluster }}" >> $GITHUB_ENV
3737
echo "CONFIG_FILE=${{ github.event.inputs.config-file-name }}" >> $GITHUB_ENV
3838
- name: Deploy til GCP

0 commit comments

Comments
 (0)