-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
236 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
--- | ||
name: Continuous Development | ||
|
||
on: | ||
push: | ||
# Run workflow every time something is pushed to the main branch | ||
branches: | ||
- dev | ||
# allow manual triggers for now too | ||
# Remember to set the following secrets in your repository's settings: | ||
# https://github.com/your_username/itu-minitwit-ci/settings/secrets/actions | ||
# DOCKER_USERNAME | ||
# DOCKER_PASSWORD | ||
# SSH_USER | ||
# SSH_KEY | ||
# SSH_HOST | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push minitwitimage | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./MiniTwit | ||
push: true | ||
tags: ${{ secrets.DOCKER_USERNAME }}/minitwitimagedev:latest | ||
|
||
# - name: Build and push mysqlimage | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# context: . | ||
# file: ./Dockerfile-mysql | ||
# push: true | ||
# tags: ${{ secrets.DOCKER_USERNAME }}/mysqlimage:latest | ||
# cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/mysqlimage:mysqlbuildcache | ||
# cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/mysqlimage:mysqlbuildcache,mode=max | ||
|
||
# - name: Build and push flagtoolimage | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# context: . | ||
# file: ./Dockerfile-flagtool | ||
# push: true | ||
# tags: ${{ secrets.DOCKER_USERNAME }}/flagtoolimage:latest | ||
# cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/flagtoolimage:flagtoolbuildcache | ||
# cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/flagtoolimage:flagtoolbuildcache,mode=max | ||
|
||
# - name: Test minitwit | ||
# run: | | ||
# docker build -t $DOCKER_USERNAME/minitwittestimage -f Dockerfile-minitwit-tests . | ||
# yes 2>/dev/null | docker-compose up -d | ||
# docker run --rm --network=itu-minitwit-network $DOCKER_USERNAME/minitwittestimage | ||
# env: | ||
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
|
||
# - name: Configure SSH | ||
# run: | | ||
# mkdir -p ~/.ssh/ | ||
# echo "$SSH_KEY" > ~/.ssh/minitwit.key | ||
# chmod 600 ~/.ssh/minitwit.key | ||
# env: | ||
# SSH_KEY: ${{ secrets.SSH_KEY }} | ||
|
||
- name: DEVployment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USER }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
docker pull magmose1/minitwitimagedev:latest | ||
docker stop minidev || true && docker rm minidev || true | ||
docker run -d -p 8082:8080 --name minidev magmose1/minitwitimagedev:latest | ||
docker ps | ||
# - name: Deploy to server | ||
# # Configure the ~./bash_profile and deploy.sh file on the Vagrantfile | ||
# run: | | ||
# ssh -i ~/.ssh/minitwit.key $SSH_USER@$SSH_HOST -o StrictHostKeyChecking=no | ||
# whoami | ||
# docker ps -a | ||
# docker images | ||
# docker pull magmose1/minitwitimage:latest | ||
# docker ps | ||
# docker stop minitwit | ||
# docker rm minitwit | ||
# docker run -d -p 8082:8080 --name mini3 magmose1/minitwitimage:latest | ||
# env: | ||
# SSH_USER: ${{ secrets.SSH_USER }} | ||
# SSH_HOST: ${{ secrets.SSH_HOST }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<link th:href="@{/styles/style.css}" rel="stylesheet" type="text/css" href="/styles/style.css" media="all"/> | ||
</head> | ||
|
||
<body> | ||
<div class="page" th:fragment="header"> | ||
<h1>MiniTwit</h1> | ||
<div class="navigation"> | ||
<div th:if="${user != 'false'}"> | ||
<a th:href="@{/{user}(user=${user})}">my timeline</a> | | ||
<a th:href="@{/favourites}">my favourites</a> | | ||
<a th:href="@{/public}">public</a> | | ||
<a th:href="@{/logout}">sign out [<span th:text="${user}">Username</span>]</a> | ||
</div> | ||
<div th:if="${user == 'false'}"> | ||
<a th:href="@{/public}">public</a> | | ||
<a th:href="@{/register}">sign up</a> | | ||
<a th:href="@{/login}">sign in</a> | ||
</div> | ||
</div> | ||
<div class="body"> | ||
<div th:if="${public == 'true' && user != 'false'}" class="twitbox"> | ||
<h3>These are your favourite twits, <span th:text="${username}"></span>!</h3> | ||
</div> | ||
<ul class="messages"> | ||
<li th:each="message : ${messages}" th:if="${messagesSize > 0}"> | ||
<img th:src="${message.gravatar_url}" width="40" height="40"/> | ||
<p> | ||
<strong> | ||
<a th:href="@{/{username}(username=${message.username})}" | ||
th:text="${message.username}"> | ||
</a> | ||
</strong> | ||
<span th:text="${message.text}"></span> | ||
<small>— <span th:text="${message.date_time}"></span></small><br> | ||
<a class="favourite" th:href="@{/removeMessageToFavourites(messageID=${message.id})}"> | ||
Remove from favourites | ||
</a> | ||
</p> | ||
</li> | ||
<li th:if="${messagesSize == 0}"> | ||
<em>There's no favourite messages so far.</em> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters