|
1 | 1 | name: Build
|
2 | 2 | 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 |
8 | 8 |
|
9 | 9 | # FIXME: Legg til docker layer caching, f.eks. https://github.com/marketplace/actions/build-docker-images-using-cache
|
10 | 10 | 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) |
0 commit comments