Skip to content

Commit

Permalink
GH Action to build docker (#1644)
Browse files Browse the repository at this point in the history
* Create docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Create docker-image.yml

* Delete docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* net6

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml

* Update docker-image.yml
  • Loading branch information
mregen committed Dec 20, 2021
1 parent 7ae5c11 commit c6742ad
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Docker Reference Server CI

on:
push:
branches: [ master, release/*, docker* ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
env:
IS_NOT_PR: ${{ !github.head_ref && true }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:

- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.x'

- name: Set Version
shell: pwsh
run: ./.azurepipelines/set-version.ps1

- name: Prepare Tag Repo Info
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]' | awk '{gsub(/-|\./, "")}1')/refserver >> $GITHUB_ENV
- name: Prepare Tag Branch info
if: env.NBGV_PublicRelease == 'False'
run: |
echo IMAGE_TAG=-$(echo ${{ github.ref }} | tr '[:upper:]' '[:lower:]' | awk '{sub(/([^\/]*\/){2}/,""); gsub(/\/|_/, "-")}1') >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: env.IS_NOT_PR == 'true'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the Docker image
run: |
cd Applications/ConsoleReferenceServer
./dockerbuild.sh
docker image ls
docker image tag consolerefserver:latest ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ env.NBGV_Version }}${{ env.NBGV_PrereleaseVersion }}${{ env.IMAGE_TAG }}
docker image tag consolerefserver:latest ghcr.io/${{ env.IMAGE_REPOSITORY }}:latest${{ env.IMAGE_TAG }}
- name: Push to GitHub Container Registry
if: env.IS_NOT_PR == 'true'
run: |
docker image push ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ env.NBGV_Version }}${{ env.NBGV_PrereleaseVersion }}${{ env.IMAGE_TAG }}
docker image push ghcr.io/${{ env.IMAGE_REPOSITORY }}:latest${{ env.IMAGE_TAG }}
docker images ghcr.io/${{ env.IMAGE_REPOSITORY }}

0 comments on commit c6742ad

Please sign in to comment.