forked from IllinoisSocialMediaMacroscope/smm-analytics
-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (128 loc) · 4.69 KB
/
manual.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Manual Docker Container Build
on:
workflow_dispatch:
inputs:
push_to_where:
description: 'Select the registry to push to'
default: 'github'
required: true
type: choice
options:
- github
- dockerhub
specific_package:
description: 'Select the specific package to build'
default: 'sentiment_analysis'
required: true
type: choice
options:
- autophrase
- histogram
- check_screen_name
- classification_predict
- classification_train
- classification_split
- collect_reddit_comment
- crimson_hexagon_monitors
- image_crawler
- name_entity_recognition
- network_analysis
- preprocessing
- screen_name_prompt
- sentiment_analysis
- topic_modeling
- clowder_create_collection
- clowder_create_dataset
- clowder_create_space
- clowder_list
- clowder_upload_file
env:
MAIN_REPO: ncsa/standalone-smm-analytics
jobs:
# ----------------------------------------------------------------------
# DOCKER BUILD
# ----------------------------------------------------------------------
docker:
runs-on: ubuntu-latest
steps:
# checkout source code
- uses: actions/checkout@v2
# calculate version information
- name: version information
run: |
if [ "${{ github.event.release.target_commitish }}" != "" ]; then
BRANCH="${{ github.event.release.target_commitish }}"
elif [[ "${{github.event_name}}" == "pull_request" ]]; then
BRANCH="PR-${{github.event.pull_request.number}}"
else
BRANCH=${GITHUB_REF##*/}
fi
echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV
if [ "$BRANCH" == "main" ]; then
CHANGELOG_FILE="containerized_analytics/smile/${{ inputs.specific_package }}/CHANGELOG.md"
if [ -e "$CHANGELOG_FILE" ]; then
VERSION=$(cat "$CHANGELOG_FILE" | grep -Eo '\[[0-9]+\.[0-9]+\.[0-9]+\]'| head -1 | tr -d '[]')
VERSIONS="latest"
OLDVERSION=""
TMPVERSION=$VERSION
while [ "$OLDVERSION" != "$TMPVERSION" ]; do
VERSIONS="${VERSIONS} ${TMPVERSION}"
OLDVERSION="${TMPVERSION}"
TMPVERSION=$(echo ${OLDVERSION} | sed 's/\.[0-9]*$//')
done
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "TAGS=${VERSIONS}" >> $GITHUB_ENV
else
echo "VERSION=latest" >> $GITHUB_ENV
echo "TAGS=latest" >> $GITHUB_ENV
fi
elif [ "$BRANCH" == "develop" ]; then
echo "VERSION=develop" >> $GITHUB_ENV
echo "TAGS=develop" >> $GITHUB_ENV
else
echo "VERSION=testing" >> $GITHUB_ENV
echo "TAGS=${BRANCH}" >> $GITHUB_ENV
fi
- name: Print Version tag
run: |
echo "${{ env.TAGS }}"
echo "${{ inputs.push_to_where }}"
echo "HUBPUSH=${{ inputs.push_to_where }}" >> $GITHUB_ENV
# login to registries
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
if: |
env.HUBPUSH == 'github' || env.HUBPUSH == 'dockerhub'
uses: elgohr/[email protected]
with:
dockerfile: Dockerfile
name: socialmediamacroscope/${{ inputs.specific_packages }}
no_push: true
workdir: containerized_analytics/smile/${{ inputs.specific_packages }}
- name: Publish doc image to Docker Hub
if: |
env.HUBPUSH == 'dockerhub'
uses: elgohr/[email protected]
with:
registry: docker.io
name: socialmediamacroscope/${{ inputs.specific_packages }}
username: ${{ secrets.HUB_USERNAME }}
password: ${{ secrets.HUB_PASSWORD }}
tags: "${{ env.TAGS }}"
workdir: containerized_analytics/smile/${{ inputs.specific_packages }}
- name: Publish doc image to Github
if: |
env.HUBPUSH == 'github'
uses: elgohr/[email protected]
with:
registry: ghcr.io
name: ncsa/${{ inputs.specific_packages }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
tags: "${{ env.TAGS }}"
workdir: containerized_analytics/smile/${{ inputs.specific_packages }}