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

Commit e56b063

Browse files
committed
Revert "Revert "Revert "Revert "Revert "Fjerner workflows for å ikke interferere med ny app"""""
This reverts commit 0e1c45b.
1 parent 0e1c45b commit e56b063

File tree

3 files changed

+174
-0
lines changed

3 files changed

+174
-0
lines changed
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Bygg for docker compose
2+
on: push
3+
env:
4+
APP: sykepengesoknad
5+
jobs:
6+
7+
build-image-for-docker-compose:
8+
if: github.ref == 'refs/heads/master'
9+
name: Build image for docker compose
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v1
14+
- run: echo "::set-env name=IMAGE::"docker.pkg.github.com/${GITHUB_REPOSITORY}/$APP-dc:latest""
15+
- name: Cache NPM dependencies
16+
uses: actions/cache@v1
17+
with:
18+
path: node_modules
19+
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
20+
restore-keys: |
21+
${{ runner.OS }}-npm-cache-
22+
- name: Install npm dependencies
23+
run: npm i
24+
- name: Run lint
25+
run: npm run lint
26+
- name: Run tests
27+
run: npm run test
28+
- name: Build application
29+
run: npm run nais-build
30+
- name: Build and publish Docker image
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}
33+
run: |
34+
docker build -t ${IMAGE} -f Dockerfile.dc .
35+
docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
36+
docker push ${IMAGE}

.github/workflows/labsdeploy.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy demo til labs
2+
on:
3+
push:
4+
branches:
5+
- 'master'
6+
env:
7+
APP: sykepengesoknad
8+
jobs:
9+
deploy-demo-to-labs-gcp:
10+
name: Deploy demo til labs gcp
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v1
15+
- name: Cache NPM dependencies
16+
uses: actions/cache@v1
17+
with:
18+
path: node_modules
19+
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
20+
restore-keys: |
21+
${{ runner.OS }}-npm-cache-
22+
- name: Generer versjon og image navn
23+
run: |
24+
TIME=$(TZ="Europe/Oslo" date +%Y.%m.%d-%H.%M)
25+
COMMIT=$(git rev-parse --short=8 HEAD)
26+
VERSION=$TIME-$COMMIT
27+
echo "::set-env name=IMAGE::"docker.pkg.github.com/${GITHUB_REPOSITORY}/$APP-demo:$VERSION""
28+
echo "::set-env name=VERSION::"$VERSION""
29+
- run: npm i
30+
- run: npm run nais-build
31+
- name: Build and publish Docker image
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}
34+
run: |
35+
docker build -t ${IMAGE} -f Dockerfile.web --build-arg BASE_IMAGE_PREFIX=node .
36+
docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
37+
docker push ${IMAGE}
38+
- name: Deploy to dev-gcp
39+
uses: nais/deploy/actions/deploy@v1
40+
env:
41+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
42+
CLUSTER: labs-gcp
43+
RESOURCE: nais-gcp.yaml

.github/workflows/workflow.yml

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Bygg, publish og deploy
2+
on: push
3+
env:
4+
APP: sykepengesoknad
5+
jobs:
6+
build-and-publish:
7+
name: Bygg, test og push Docker image
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v1
12+
- name: Generer versjon og image navn
13+
run: |
14+
TIME=$(TZ="Europe/Oslo" date +%Y.%m.%d-%H.%M)
15+
COMMIT=$(git rev-parse --short=8 HEAD)
16+
VERSION=$TIME-$COMMIT
17+
echo "::set-env name=IMAGE::"docker.pkg.github.com/${GITHUB_REPOSITORY}/$APP:$VERSION""
18+
echo "::set-env name=VERSION::"$VERSION""
19+
- run: echo $VERSION > VERSION.txt
20+
- name: Last opp VERSION til neste job
21+
uses: actions/upload-artifact@v1
22+
with:
23+
name: VERSION.txt
24+
path: VERSION.txt
25+
- name: Cache NPM dependencies
26+
uses: actions/cache@v1
27+
with:
28+
path: node_modules
29+
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
30+
restore-keys: |
31+
${{ runner.OS }}-npm-cache-
32+
- name: Install npm dependencies
33+
run: npm i
34+
- name: Run lint
35+
run: npm run lint
36+
- name: Run tests
37+
run: npm run test
38+
- name: Build application
39+
run: npm run nais-build
40+
- name: Build and publish Docker image
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}
43+
run: |
44+
docker build -t ${IMAGE} .
45+
docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
46+
docker push ${IMAGE}
47+
48+
deploy-to-dev-sbs:
49+
name: Deploy til dev-sbs (Q1)
50+
runs-on: ubuntu-latest
51+
needs: build-and-publish
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v1
55+
- name: Last ned versjon
56+
uses: actions/download-artifact@v1
57+
with:
58+
name: VERSION.txt
59+
path: .
60+
- run: echo "::set-env name=VERSION::"`cat VERSION.txt`""
61+
- run: echo "::set-env name=IMAGE::"docker.pkg.github.com/${GITHUB_REPOSITORY}/$APP:$VERSION""
62+
- uses: nais/deploy/actions/deploy@v1
63+
name: Deploy to dev-sbs
64+
env:
65+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
66+
CLUSTER: dev-sbs
67+
RESOURCE: nais-dev.yaml
68+
69+
deploy-to-prod-sbs:
70+
if: github.ref == 'refs/heads/master'
71+
name: Deploy til prod-sbs (Produksjon)
72+
runs-on: ubuntu-latest
73+
needs: build-and-publish
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v1
77+
- name: Last ned versjon
78+
uses: actions/download-artifact@v1
79+
with:
80+
name: VERSION.txt
81+
path: .
82+
- run: echo "::set-env name=VERSION::"`cat VERSION.txt`""
83+
- run: echo "::set-env name=IMAGE::"docker.pkg.github.com/${GITHUB_REPOSITORY}/$APP:$VERSION""
84+
- uses: nais/deploy/actions/deploy@v1
85+
name: Deploy to prod-sbs
86+
env:
87+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
88+
CLUSTER: prod-sbs
89+
RESOURCE: nais-prod.yaml
90+
- uses: actions/create-release@v1
91+
env:
92+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
with:
94+
tag_name: ${{ env.VERSION }}
95+
release_name: ${{ env.VERSION }}

0 commit comments

Comments
 (0)