Skip to content

Commit

Permalink
Merge pull request #1340 from SwanseaUniversityMedical/Development
Browse files Browse the repository at this point in the history
ci/cd
  • Loading branch information
elmessary authored Jul 12, 2023
2 parents fe9adb0 + af47741 commit 06a2940
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 82 deletions.
159 changes: 159 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Build and Release

on:
push:
branches:
- '**'

env:
HARBOR_REGISTRY: ${{ vars.HARBOR_REGISTRY }}
HARBOR_PROJECT: ${{ vars.HARBOR_PROJECT }}
HARBOR_REPO: ${{ vars.HARBOR_REPO }}
HARBOR_USER: ${{ vars.HARBOR_USER }}
HARBOR_TOKEN: ${{ secrets.HARBOR_TOKEN }}

jobs:
release-container:
runs-on: ubuntu-latest

env:
TAG_PREFIX: 'Concept-Library'
TAG_FORMAT: 'Concept-Library-${version}'

steps:
- name: clone repo
uses: actions/checkout@v3

- name: build container
run: |
docker build -t image -f "Dockerfile" .
- name: registry login
run: |
echo "$HARBOR_TOKEN" | docker login $HARBOR_REGISTRY -u $HARBOR_USER --password-stdin
- name: generate token
id: generate-token
uses: tibdex/[email protected]
with:
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: semantic release dry run
uses: docker://ghcr.io/codfish/semantic-release-action:v2
id: semantic-dry
with:
dry_run: true

branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'master'
]
tag_format: ${{ env.TAG_FORMAT }}

plugins: |-
[
['@semantic-release/commit-analyzer', {
"releaseRules": [
{"type": "major", "release": "major"},
{"type": "minor", "release": "minor"},
{"type": "patch", "release": "patch"},
{"type": "no-release", "release": false},
{"type": "chore", "release": "patch"},
{"type": "refactor", "release": "patch"},
{"type": "style", "release": "patch"},
{"type": "docs", "release": false},
{"type": "test", "release": false},
{"type": "ci", "release": false},
{"type": "feat", "release": "minor"},
{"type": "revert", "release": "patch"},
{"type": "perf", "release": "patch"},
{"type": "fix", "release": "patch"},
{"type": "build", "release": "patch"},
],
}]
]
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

- name: semantic release
if: steps.semantic-dry.outputs.new-release-published == 'true'
uses: docker://ghcr.io/codfish/semantic-release-action:v2
id: semantic
with:
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'master'
]
tag_format: ${{ env.TAG_FORMAT }}

additional_packages: |
['@semantic-release/exec']
plugins: |-
[
['@semantic-release/commit-analyzer', {
"releaseRules": [
{"type": "major", "release": "major"},
{"type": "minor", "release": "minor"},
{"type": "patch", "release": "patch"},
{"type": "no-release", "release": false},
{"type": "chore", "release": "patch"},
{"type": "refactor", "release": "patch"},
{"type": "style", "release": "patch"},
{"type": "docs", "release": false},
{"type": "test", "release": false},
{"type": "ci", "release": false},
{"type": "feat", "release": "minor"},
{"type": "revert", "release": "patch"},
{"type": "perf", "release": "patch"},
{"type": "fix", "release": "patch"},
{"type": "build", "release": "patch"},
],
}],
['@semantic-release/exec', {
"generateNotesCmd": "echo '${ process.env.RELEASE_NOTES }'"
}],
'@semantic-release/release-notes-generator',
['@semantic-release/github', {
"successComment": false,
"failTitle": false
}]
]
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
RELEASE_NOTES: |
```
echo "<token>" | docker login ${{ env.HARBOR_REGISTRY }} -u <username> --password-stdin
docker pull ${{ env.HARBOR_REGISTRY }}/${{ env.HARBOR_PROJECT }}/${{ env.HARBOR_REPO }}:${{ steps.semantic-dry.outputs.release-version }}
```
- name: container push to registry
id: container-push
if: steps.semantic.outputs.new-release-published == 'true'
run: |
docker tag image $HARBOR_REGISTRY/$HARBOR_PROJECT/$HARBOR_REPO:$TAG
docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/$HARBOR_REPO:$TAG
env:
TAG: ${{ steps.semantic.outputs.release-version }}

- name: delete orphaned release on container push failure
uses: dev-drprasad/[email protected]
if: (failure() && steps.container-push.outcome == 'failure') && steps.semantic.outputs.new-release-published == 'true'
with:
tag_name: ${ env.TAG_PREFIX }-${{ steps.semantic.outputs.release-version }}
delete_release: true
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ docker/
CodeListLibrary_project/.settings/org.eclipse.core.resources.prefs
.settings/org.eclipse.ltk.core.refactoring.prefs
requirements/base - Django2.txt
docs/~$plication Guide.docx
docs/~$plication Guide.docx
.idea
23 changes: 0 additions & 23 deletions .gitlab-ci.yml

This file was deleted.

47 changes: 44 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,48 @@
FROM cll/os AS base
FROM amd64/debian:bullseye AS base

#ENV http_proxy=http://192.168.10.15:8080
#ENV https_proxy=http://192.168.10.15:8080
ARG DEBIAN_FRONTEND=noninteractive

EXPOSE 80
EXPOSE 443

# update packages
RUN \
apt-get update -y -q && \
apt-get upgrade -y -q && \
apt-get install -y -q --no-install-recommends apt-utils && \
apt-get install -y -q ssh apache2 && \
apt-get install -y -q libapache2-mod-wsgi-py3 && \
apt-get install -y -q wget && \
apt-get -y -q install sudo nano && \
apt-get install -y -q redis-server




# install this for LDAP to work
RUN apt-get install -y -q libsasl2-dev python-dev libldap2-dev libssl-dev

##RUN apt-get install -y -q git

# install & upgrade pip
RUN \
apt-get install -y -q python3-pip
#&& \
#pip ${pip_proxy} install --trusted-host pypi.org --trusted-host files.pythonhosted.org pip==20.2

#RUN \
# apt remove python2.7

RUN \
pip install --upgrade pip

RUN \
pip install virtualenv
#&& \
#pip install psycopg2-binary==2.8.6

RUN mkdir -p /home/config_cll/cll_srvr_logs
RUN chmod 750 /home/config_cll/cll_srvr_logs

ENV LC_ALL=C.UTF-8

Expand Down
55 changes: 0 additions & 55 deletions OS/Dockerfile

This file was deleted.

0 comments on commit 06a2940

Please sign in to comment.