Skip to content

Commit

Permalink
CI test
Browse files Browse the repository at this point in the history
  • Loading branch information
StenAL committed Jul 6, 2024
1 parent f75231d commit 82d83d1
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 59 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/client-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
paths:
- "client/**" # limit workflow only to changes in frontend folder
- ".github/workflows/server-cd.yml"
pull_request:
branches:
- main
paths:
- "client/**"
- ".github/workflows/client-cd.yml"
# pull_request:
# branches:
# - main
# paths:
# - "client/**"
# - ".github/workflows/client-cd.yml"


defaults:
Expand Down Expand Up @@ -44,8 +44,8 @@ jobs:
run: npm run compile

publish:
needs: build
if: github.ref == 'refs/heads/main'
# needs: build
# if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: checkout current repository
Expand Down Expand Up @@ -73,6 +73,7 @@ jobs:
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
protocol: tcp6
source: "client/build/**"
target: "/var/www/stonks"
strip_components: 2
102 changes: 51 additions & 51 deletions .github/workflows/server-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,63 +15,63 @@ on:
- ".github/workflows/server-cd.yml"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout current repository
uses: actions/checkout@v4

- name: set up Java 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: build application jar
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
arguments: build
build-root-directory: server

- name: create server artifact from jar
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: server
path: server/build
# build:
# runs-on: ubuntu-latest
# steps:
# - name: checkout current repository
# uses: actions/checkout@v4
#
# - name: set up Java 21
# uses: actions/setup-java@v4
# with:
# java-version: '21'
# distribution: 'temurin'
#
# - name: build application jar
# uses: gradle/actions/setup-gradle@v3
# with:
# gradle-version: wrapper
# arguments: build
# build-root-directory: server
#
# - name: create server artifact from jar
## if: github.ref == 'refs/heads/main'
# uses: actions/upload-artifact@v4
# with:
# name: server
# path: server/build

publish:
needs: build
if: github.ref == 'refs/heads/main'
# needs: build
# if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: checkout current repository
uses: actions/checkout@v4

- name: download server artifact
uses: actions/download-artifact@v4
with:
name: server
path: server/build

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: build and publish server Docker image
uses: docker/build-push-action@v6
with:
context: server
file: server/docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: stenal/baltic-stock-server:latest
# - name: download server artifact
# uses: actions/download-artifact@v4
# with:
# name: server
# path: server/build
#
# - name: set up Docker Buildx
# uses: docker/setup-buildx-action@v3
#
# - name: log in to DockerHub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - name: build and publish server Docker image
# uses: docker/build-push-action@v6
# with:
# context: server
# file: server/docker/Dockerfile
# platforms: linux/amd64,linux/arm64
# push: true
# tags: stenal/baltic-stock-server:latest

- name: setup SSH
shell: bash
Expand All @@ -81,7 +81,7 @@ jobs:
touch /home/runner/.ssh/id_rsa
echo -e "${{secrets.SSH_KEY}}" > /home/runner/.ssh/id_rsa
chmod 700 /home/runner/.ssh/id_rsa
ssh-keyscan -t rsa,dsa,ecdsa,ed25519 ${{secrets.SSH_HOST}} >> /home/runner/.ssh/known_hosts
ssh-keyscan -t rsa,dsa,ecdsa,ed25519 laane.xyz >> /home/runner/.ssh/known_hosts
- name: run Ansible deployment playbook
shell: bash
Expand Down

0 comments on commit 82d83d1

Please sign in to comment.